dataGridView事件绑定问题
想实现:在DataGridView 中有两个DataGridViewComboBoxColumn,一个DataGridViewComboBoxColumn的项目(Item)数据源是固定的
另一个DataGridViewComboBoxColumn的项目(Item)数据源是根据前面那个DataGridViewComboBoxColumn
选中的的项目(Item)而变化
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (this.dataGridView1.CurrentCell.OwningColumn.Name == "clmTest")
{
((ComboBox)e.Control).SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
}
}
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.dataGridView1.CurrentRow.Cells["name"].Value = ((ComboBox)sender).Text;
}
现在的问题是:当到第二rows时,事件触发两次,后面依次累加,该怎么处理。
补充:.NET技术 , C#