This ? is directed to An expert using bound controls. I have a dataset which is filled once when the application loads. On each form i use dataview objects to filter it down to one record. The problems i am having are data bindings to checkbox, combobox, and textbox. When i make a change to any of these controls i need the new value to take place immediately becuase these controls are tied to lots of validation code and they enable and disable certain controls values. For example on a combo box i fill them using a data table that i create which reads parts into the boxes along with a sequence value from a table called parts. On form load i bind the the control using the code below
Public Sub LoadSBCombo()
LoadPartCombo(myStock, "stock_building", "seq ASC")
comStockBuildings.DataSource = myStock
comStockBuildings.DisplayMember = "display"
comStockBuildings.ValueMember = "value"
myTable("stock_bldg_choice") = cNull(myTable("stock_bldg_choice"), "Integer")
comStockBuildings.DataBindings.Add("SelectedValue", myQuoteDv, "stock_bldg_choice")
And on the event of this combo box is where i refresh the value by doing this...
Private Sub comStockBuildings_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles comStockBuildings.SelectedValueChanged
If formLoaded And stockFlag Then
myTable("stock_bldg_choice") = CType(comStockBuildings.SelectedValue, Integer) <== this always doesn't work integer to dataview row exception thrown
The reason for doing this is because before i inserted that line the combobox would just keep the same selected value and i had no idea why i though the bound value would change. I need a true bound controls experts advice because this is driving me nuts!