WinForms binding
I have some controls associated with a BindingSource control.
I want to perform a calculation when a value changes in one control and sets the result on another control.
Am I updating the textbox that the property is bound to, or am I updating the underlying object that will update the control anyway (hopefully)?
When I change combobox A (OnPropertyChange), the new computed result is updated in textbox B. This works great, but I noticed that when I leave combobox A it reverts back to its original value. What's going on here!
Private Sub ComboBoxEditCostCode_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxEditCostCode.EditValueChanged
Select Case ComboBoxEditCostCode.EditValue
Case "7"
CType(TransactionEntityBindingSource.Current, TblTransactionsEntity).Qbdescription = "7-is here"
Case "2"
CType(TransactionEntityBindingSource.Current, TblTransactionsEntity).Qbdescription = "2-is here"
Case Else
CType(TransactionEntityBindingSource.Current, TblTransactionsEntity).Qbdescription = "7-is here"
End Select
End Sub
a source to share
Tell us more about your change, how is the second textbox anchored?
You should change the original data instead of changing the value of the textbox b.
Also when textbox A loses it the focus raises the EndEdit event and I think the binding engine is updating the value in textbox B.
You can control what action is being edited when you bind the textboxes.
a source to share