我想出了如何在datagrid视图中向我的组合框添加事件:
private void dataGridViewCaseObjects_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
var combo = e.Control as ComboBox;
if (combo != null)
{
combo.SelectedIndexChanged -= ComboBox_SelectedIndexChanged;
combo.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
}
}
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
// Actually commit the selected string to combobox
}
如何从这一点强制提交组合框?