Winforms ComboBox - 直接设置值

时间:2012-10-09 07:40:40

标签: winforms combobox

我想出了如何在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 
    }

如何从这一点强制提交组合框?

0 个答案:

没有答案