I think if you look at the steps that occur, you will see what your problem was.
It's also important to understand that a GridView uses the same comboBox to do all of it's editing. So, let's keep track of the event handlers as you add or remove them. Let's call the comboBox for the GridView cboGridView
cboGridView Events
none
So, let's say that first, they edit the Country ComboBox. So the
dgvContactDetail_EditingControlShowing
method fires.
I assume that in this case, the
dgvContactDetail.CurrentCell.ColumnIndex
equals 1 if they're editing the Country information.
So, you remove an event handler for country changing (which for the first time run was never added). Then, you add an event handler for the country changing.
cboGridView Events
SelectionChangeCommitted: countryComboBox_SelectionChangeCommitted
So, now when they change the country, the states box fills in.
No, the user goes to edit the states box (which I assume is 2). So, what do you do?
You remove an event handler for stateComboBox_SelectionChangeCommitted which you hadn't added yet.
cboGridView Events
SelectionChangeCommitted: countryComboBox_SelectionChangeCommitted
Now, you add an event handler for stateComboBox_SelectionChangeCommitted.
cboGridView Events
SelectionChangeCommitted: countryComboBox_SelectionChangeCommitted &
stateComboBox_SelectionChangeCommitted
So, now, when the stateComboBox is changed, what will happen? Both SelectionChangeCommitted events will fire.
What you really want to do is remove the event handler at the end of both countryComboBox_SelectionChangeCommitted and stateComboBox_SelectionChangeCommitted like:
private void countryComboBox_SelectionChangeCommitted(object sender, EventArgs e)
{
(ComboBox)sender.SelectionChangeCommitted -= new EventHandler(stateComboBox_SelectionChangeCommitted);
}