当组合框选择的索引发生更改时,我使用 SelectionChangeCommitted 来捕获事件,但我无法获得它的新值或索引。
private void ruleList_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (e.Control is ComboBox)
{
ComboBox comboBox = e.Control as ComboBox;
comboBox.SelectionChangeCommitted += ruleListColumnComboSelectionChanged;
}
}
private void ruleListColumnComboSelectionChanged(object sender, EventArgs e)
{
string value = ruleList.CurrentCell.Value.ToString(); // just return the old value before the change
}