DataGridViewComboBoxColumn not showing values

ComboBoxColumn , DataGridView , Csharp Philadelphia, United States
  • 11 years ago

    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

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous