代码
private void dataGrideTextProp_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (dataGrideTextProp.CurrentCell.ColumnIndex == 1 && dataGrideTextProp.CurrentCell.RowIndex != -1)
{
(e.Control as ComboBox).SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
}
}
void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox comboBox = sender as ComboBox;
//干自己的事情
//
comboBox.SelectedIndexChanged -= new EventHandler(ComboBox_SelectedIndexChanged);
//System.Threading.Thread.Sleep(500);
//comboBox.Hide();
}
{
if (dataGrideTextProp.CurrentCell.ColumnIndex == 1 && dataGrideTextProp.CurrentCell.RowIndex != -1)
{
(e.Control as ComboBox).SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
}
}
void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox comboBox = sender as ComboBox;
//干自己的事情
//
comboBox.SelectedIndexChanged -= new EventHandler(ComboBox_SelectedIndexChanged);
//System.Threading.Thread.Sleep(500);
//comboBox.Hide();
}