vb.net combobox binding
Posted on 2009-04-01
I have a winform with a datagridview and a combobox. In the form_load event I create a dataset table and then set it to the combobox's datasource. When I move from datagridview row to row, the combobox.text stays in synch just like it should .. the selectedvalue field is in the same datasource as the datagridview's datasource. The problem is when I change the datasource of the combobox, the combobox displaymembers and valuemembers change as they should per the coding, but the combobox does not automatically synch to the displaymember (based on the selectedvalue matching an matching valuemember in the combobox list).
So my questions are:
a) Why does the synching work in the form_load event automatically?
b) Why does changing the datsource cause the synching to not work and how do I fix the synching?
c) Can I reference the combobox's pre-datasource change 'selectedvalue' (but the combobox.text is null because the selectedvalue cannot find a matching valuemember thus the reason for needing to update the combobox datasource)