Napivo1972
Regular
- Joined
- Aug 31, 2004
- Messages
- 85
Hi,
Its been a while since I posted here I have been away from programming for a while.
I have a problem with a data bound combo box. I included the forms load event where I do all the bindings.
I have a form with a combo box cmbTVARates and 2 textboxes txtValue and txtName
I use the combo box to select a record but I dont edit in it. The data is send to the 2 textboxes where I edit the data and then save it. This works like a charm but while the data is saved to the datatable and even saved to the database, the combo box is not updated with the new names and added rows.
I have tried breaking and restoring data bindings, call refresh, update or even invalidate but nothing seems to work.
Anyone have an idea?
Its been a while since I posted here I have been away from programming for a while.
I have a problem with a data bound combo box. I included the forms load event where I do all the bindings.
I have a form with a combo box cmbTVARates and 2 textboxes txtValue and txtName
I use the combo box to select a record but I dont edit in it. The data is send to the 2 textboxes where I edit the data and then save it. This works like a charm but while the data is saved to the datatable and even saved to the database, the combo box is not updated with the new names and added rows.
I have tried breaking and restoring data bindings, call refresh, update or even invalidate but nothing seems to work.
Anyone have an idea?
Visual Basic:
Private Sub frmTVA_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dv = New DataView(Startup.DB.t_TVA.DataTable)
dv.Sort = "ID"
Dim b As Binding
cmbTVARates.DataSource = dv
cmbTVARates.DisplayMember = "Name"
cmbTVARates.ValueMember = "Value"
b = txtValue.DataBindings.Add("Text", dv, "Value")
AddHandler b.Format, AddressOf SingleToPercent
AddHandler b.Parse, AddressOf PercentToSingle
txtName.DataBindings.Add("Text", dv, "Name")
' Specify the CurrencyManager for the DataView.
cm = CType(Me.BindingContext(dv), CurrencyManager)
AddHandler cm.CurrentChanged, AddressOf CM_CurrentChanged
AddHandler cm.ItemChanged, AddressOf CM_ItemChanged
AddHandler cm.MetaDataChanged, AddressOf CM_MetaDataChanged
AddHandler cm.PositionChanged, AddressOf CM_PositionChanged
End Sub