https://blog.csdn.net/ad13adsa/article/details/82108969
private void dataGridViewX1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{ e.Control.Controls.Clear(); if (e.Control is DataGridViewTextBoxEditingControl && this.dataGridViewX1.CurrentCell.ColumnIndex == 1) { ComboBoxEx btn = new ComboBoxEx(); e.Control.Controls.Add(btn); btn.Dock = DockStyle.Fill; btn.Cursor = Cursors.Default; btn.DataSource = this.dclass.GetDataTable("select classid 编号,classname 名称 from WG_Class "); btn.ValueMember = "编号"; btn.DisplayMember = "名称"; btn.SelectedValueChanged += delegate { this.dataGridViewX1.CurrentCell.Value = btn.Text; }; } }--------------------- 作者:莱丝兰迪 来源:CSDN 原文:https://blog.csdn.net/ad13adsa/article/details/82108969 版权声明:本文为博主原创文章,转载请附上博文链接!