When i am adding eventHandler on combo in datagridview, its adding eventHandler to all other combo o
- by Rajesh Rolen- DotNet Developer
i am using VS2005 (c#.net desktop application). when i am adding eventHandler to a combo of datagridview, its automatically adding same eventhandler to all other combos of same datagridview..
my code:
private void dgvtstestdetail_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
DataGridView grid = (sender as DataGridView);
if (grid.CurrentCell.OwningColumn == grid.Columns["gdvtstd_TestParameter"])
{
ComboBox cb = (e.Control as ComboBox);
cb.SelectedIndexChanged -= new EventHandler(dvgCombo_SelectedIndexChanged);
cb.SelectedIndexChanged += new EventHandler(dvgCombo_SelectedIndexChanged);
}
}