المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : DataGridViewComboBoxColumn not showing values



C# Programming
11-11-2009, 03:00 AM
Hi All,
I did raise this question yesterday also, but its not showing up in the message board, thus pasting it again.

I have a DataGridView where in I am trying to add DataGridViewComboBoxColumn. Though the column is getting added but the combobox is empty.


DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
cell.Items.Add("One");
cell.Items.Add("Two");
cell.Items.Add("Three");
DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();
column.HeaderText = "SELECT";
column.Name = "ItemSelect";
column.CellTemplate = cell;
column.DropDownWidth = 160;
column.Width = 90;
column.MaxDropDownItems = 3;
column.FlatStyle = FlatStyle.Flat;
column.ReadOnly = true;
//column.Items.AddRange("One", "Two", "Three"); -- I tried this way too
myDataGridView.Columns.Insert(0, column);


After displaying the values which event I should handle to get the selected value in combobox?

Thanks in Advance