Questions tagged [datagridviewcombobox]

254 questions
31
votes
10 answers

DataGridViewComboBoxCell Binding - "value is not valid"

I'm trying to bind separate ComboBox cells within a DataGridView to a custom class, and keep getting an error DataGridViewComboBoxCell value is not valid I'm currently assigning the data source for the cell to an IList from a…
Ian
  • 30,720
  • 20
  • 100
  • 179
16
votes
8 answers

DataGridView set column cell Combobox

I have tables like that in Datagridview: Name Money ------------- Hi 100 //here Combobox with member {10,30,80,100} to choose Ki 30 //here Combobox with member {10,30,80,100} to choose I want to change Column "Money" Value from…
Uni Le
  • 731
  • 5
  • 17
  • 28
11
votes
3 answers

How to make the ComboBox drop down list resize itself to fit the largest item?

I've got a DataGridView with a ComboBox in it that might contain some pretty large strings. Is there a way to have the drop down list expand itself or at least wordwrap the strings so the user can see the whole string without me having to resize the…
Isaac Bolinger
  • 6,978
  • 10
  • 48
  • 88
8
votes
2 answers

DataGridViewComboBoxColumn name/value how?

I thought this was simple like in Access. User needs to set the value of one column in a datatable to either 1 or 2. I wanted to present a combobox showing "ONE", "TWO" and setting 1 or 2 behind the scene, like I did lots of times in…
Reinhard
6
votes
2 answers

DataGridViewComboBoxColumn set the selectedindex

hi i runtime bind the data into datagridview combobox. But how do i make it to auto display the first item? i do not able find the selectedindex from DataGridViewComboBoxColumn. DataGridViewComboBoxColumn cbStudentCourse =…
VeecoTech
  • 2,011
  • 7
  • 36
  • 47
6
votes
3 answers

Programmatically add cells and rows to DataGridView

I'm struggling with DataGridViewComboBoxCell. On some cases (let's say, events) I must preselect a value of ComboBox in my Form's DataGridView. When user changes one box, I am able to change another programatically like this: var item =…
6
votes
2 answers

What a strange behavior in AutoComplete in DataGridViewCombobox column?

I am using the (EditingControlShowing) event to Enable AutoComplete in DataGridViewComboBox Column. private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (e.Control is…
5
votes
1 answer

C# Winforms DatagridviewCombobox exception String cannot be converted to class

I am encountering an exception when selecting a new value from a datagridviewcombobox(dropdown menu) control embedded in a datagridview. The combobox is populated by a BindingSource, which is populated with instances of my class. I can display the…
Moz
  • 51
  • 2
5
votes
1 answer

C# Runtime Error: "DataGridViewComboBoxCell value is not valid"

I've been working most of the day on this, and the solution continues to elude me. My Winform application contains a DataGridView wherein two of the columns are ComboBox dropdown lists. Oddly, the DataGridView appears to populate correctly, but it…
Jim Fell
  • 12,390
  • 29
  • 117
  • 192
5
votes
3 answers

How to bind data in datagridview combobox column

Here are contacts but we can have multiple contacts so i want to show a list in combobox DataTable dt = new DataTable(); dt = MainClass.GetDatabyQuery("select * from tbl"); if (dt.Rows.Count > 0) { dgv_ClientDetail.DataSource = dt; } I…
Vampire
  • 308
  • 1
  • 4
  • 10
4
votes
2 answers

DataGridviewComboBox requires 2 clicks to show the list of items

Possible Duplicate: Open dropdown(in a datagrid view) items on a single click We have a DataGridView where one column is a ComboBox with the DropDownButton style. The DataGridView is in FullRowSelect mode. Let's assume that I have 5 rows, and row…
4
votes
4 answers

How to bound a DataGridViewComboBoxColumn to a object?

I'm trying to bound a DataGridViewComboBoxColumn to an instance of Foo, but when i set a value on the grid i got a ArgumentException telling me that i can not convert from String to Foo. var data = (from item in someTable select new {…
albertein
  • 23,752
  • 5
  • 51
  • 57
4
votes
1 answer

Databinding a combobox column to a datagridview per row (not the entire column)

There are a few posts about this, but after hours of searching I still can't find what I need. The answer in the following post almost gets me what I want: Combobox for Foreign Key in DataGridView Question 1: Going off that example where a Product…
4
votes
3 answers

DataGridView linked to DataTable with Combobox column based on enum

Having spent a lot of yesterday searching on this one I have to give up. I have a DataGridView linked to a Datatable. One of the columns is an enum and I want that to show as a Combobox column. I found this link Create drop down list options from…
RosieC
  • 608
  • 2
  • 11
  • 23
4
votes
1 answer

Add item to DataGridViewComboBoxColumn

I have a DataGridView and I change one column to a DataGridViewComboBoxColumn. And I can edit the Items to put some data in it and it works. But I want to put the Items in program, therefore, I try to use dataGridView1.Columns["drop_column"]. But it…
Dennys
  • 561
  • 2
  • 11
  • 32
1
2 3
16 17