3
我的代碼:DataGridView的組合框格室C#
DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
DataTable data = new DataTable();
data.Columns.Add(new DataColumn("Value", typeof(string)));
data.Columns.Add(new DataColumn("Description", typeof(string)));
data.Rows.Add("5", "6");
data.Rows.Add("51", "26");
data.Rows.Add("531", "63");
cell.DataSource = data;
cell.ValueMember = "Value";
cell.DisplayMember = "Description";
cell.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
dataGridView1.Rows[0].Cells[0] = cell;
它顯示組合框,但無法選擇它的任何價值。 什麼是錯的
我不知道爲什麼,但使用此代碼(對於可爲空的項目)不顯示選定的值,但確實顯示了刪除框上的項目列表。 – itsho 2012-12-29 23:03:44