On a Windows Form I have two DataGridViews, one for each of two related tables. They are related on a common Key_ID field. I want them to always stay linked on that Key_ID so that the selected rows stay in sync and if Key_ID is selected in on DataGridView the row with the same Key_ID is selected in the other DataGridView.
I'm currently using a ComboBox bound as follows to link them:
Data Source: BindingSource1
Display Member: Some Text
Value Member: Table1.Key_ID
Selected Value: Table2.Key_ID
The problem with this is that when I scroll down through the rows the textbox I have capturing the information I need is a row behind. It displays the value from the row I have just left not the current row. I have a SQL query run on the ComboBox.SelectedIndexChanged event.
I'd like to do away with the combobox entirely and just link the two DataGridView directly. Any ideas?
I'm using VB.NET in VS2005, .Net 2.0