I wouldn't do it like that. Instead don't use a DateReader, use a DataAdapter, and use the .NET built in code to access the data.
This code uses SQL Server instead of OleDb, but it's the same for your DB - I happen to have SSMS open so it's easier for me to play with SQL Server at the moment:
using (SqlConnection con = new SqlConnection(strConnect))
{
DataTable dt = new DataTable();
using (SqlDataAdapter da = new SqlDataAdapter("Select BCODE, BNAME FROM Brand", con))
{
da.Fill(dt);
cmbbCode.DataSource = dt;
cmbbCode.DisplayMember = "BCODE";
cmbbName.DataSource = dt;
cmbbName.DisplayMember = "BNAME";
cmbbCode.SelectedIndex = 0;
}
}
This reads the data from your DB, and tells each ComboBox to display a different value from the same record.
Then set them both to handle the SelectedIndexChanged event via the same handler:
private void cmbBoth_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cb = sender as ComboBox;
if (cb != null && cmbbCode.DataSource != null && cmbbName.DataSource != null)
{
int index = cb.SelectedIndex;
if (index >= 0)
{
if (cmbbCode.SelectedIndex != index) cmbbCode.SelectedIndex = index;
if (cmbbName.SelectedIndex != index) cmbbName.SelectedIndex = index;
}
}
}
The handler gets the new index from whichever ComboBox the user just changed, and sets it to them both. The null checks make sure that both are loaded already (or you'd get an error that the index is out of range) and the "is it the same index?" checks make sure that we don;t get an infinite loop of index changes!
Try it: it's a lot simpler to use than you might think, and it lets the system handle everything for you, which is much cleaner than your solution.