Associate a combobox with a textbox
About this subject we can find in the Wrox book "Expert One on One Visual Basic 2005" in chapter 4 page 159 the following code:
With cboEmployeeID
.DataSource = dsLookups.Tables("EmplsLookup")
.DisplayMember = "EmployeeName"
.ValueMember = "EmployeeID"
.DataBindings.Clear()
.DataBindings.Add(New Binding("SelectedValue", OrdersBindingSource, "EmployeeID, True))
End With
Because i'm not sure i understand this code correct, i like if my understanding as follows is wright or wrong:
As i understand this code I believe that first of all the combobox is bound to the table "EmplsLookup" ,shows the EmployeeName of the current Employee, but saves its EmployeeID.
Next the binding is broken and a new binding is made, but now the selected value of the combobox ( = EmployeeID ?) is bound to the field EmployeeID of the OrderBindingSource.
Is this correct and what happens after the second binding is made?
Does this means that the selected value in the combobox will be changed to the current EmployeeID from the OrdersBindingSource ?
|