在运行时编辑datagridviewComboboxcolumn

时间:2016-09-16 16:30:24

标签: c# datagridview

我试图在运行时搜索dataGridviewcomboboxcoulmn但是没有成功。

  private void dataGridView2_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
    {
        DataGridViewCell cel = dataGridView2.CurrentCell;
        DataGridViewRow r = dataGridView2.CurrentRow;


        if (e.Control.GetType() == typeof(DataGridViewComboBoxEditingControl))
        {
            MessageBox.Show("Tracked");
            if (cel == r.Cells[0])
            {
                DataGridViewComboBoxEditingControl c = e.Control as DataGridViewComboBoxEditingControl;
                c.DropDownStyle = ComboBoxStyle.DropDown;
            }
        }
    }

0 个答案:

没有答案