E
Earl
I'm trying to get dual-use out of some controls on one form. Essentially I'm
trying to edit the datagrid without either doing an edit within the grid
itself or populating a new form with those values.
The problem is with the combo, since its text value is in a lookup table by
ID. In the initial instance, the combo is bound to an array list. The
displaymember property provides the text. When I save the form values, this
populates the datagrid with a row of all these values. So far, so good.
When the user clicks on a row of the datagrid, I use the currency manager to
bind the values in the datagrid row back to the text boxes and combos (on
the same form) from whence they originated. One of the values I want to
re-populate is the combo text (no problem with the text boxes and dt
picker). However, instead, I get the ID (which is of course correct, since
it is the actual value in the table). I need to translate the binding of
the ID back to the actual text value that the ID selects (note that these
values will be used to Update the grid values).
Dim drvDetail As DataRowView
Dim vueDetail As DataView
Me.BindingContext(vueDetail).Position = cmSupply.Position
cmbSuppliers.DataBindings.clear
.............
'need to convert the ID to the actual name
cmbSuppliers.DataBindings.Add("Text", vueDetail, "SupplierID")
trying to edit the datagrid without either doing an edit within the grid
itself or populating a new form with those values.
The problem is with the combo, since its text value is in a lookup table by
ID. In the initial instance, the combo is bound to an array list. The
displaymember property provides the text. When I save the form values, this
populates the datagrid with a row of all these values. So far, so good.
When the user clicks on a row of the datagrid, I use the currency manager to
bind the values in the datagrid row back to the text boxes and combos (on
the same form) from whence they originated. One of the values I want to
re-populate is the combo text (no problem with the text boxes and dt
picker). However, instead, I get the ID (which is of course correct, since
it is the actual value in the table). I need to translate the binding of
the ID back to the actual text value that the ID selects (note that these
values will be used to Update the grid values).
Dim drvDetail As DataRowView
Dim vueDetail As DataView
Me.BindingContext(vueDetail).Position = cmSupply.Position
cmbSuppliers.DataBindings.clear
.............
'need to convert the ID to the actual name
cmbSuppliers.DataBindings.Add("Text", vueDetail, "SupplierID")