Questions tagged [datagridviewcombobox]
263 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
- 33,605
- 26
- 118
- 198
17
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
- 783
- 6
- 17
- 30
12
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
- 7,328
- 11
- 52
- 90
10
votes
3 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
7
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 =…

YOhan
- 505
- 3
- 6
- 17
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,073
- 8
- 37
- 49
6
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
- 320
- 1
- 4
- 10
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…

houssam
- 1,823
- 15
- 27
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
- 1
- 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
- 13,750
- 36
- 127
- 202
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…

SomethingBetter
- 1,294
- 3
- 16
- 32
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
- 26,396
- 5
- 54
- 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…

goku_da_master
- 4,257
- 1
- 41
- 43
4
votes
1 answer
DataGridViewComboBoxColumn behaves differently on Windows 7+ OS
I've made a client application in Windows Forms. I've used Windows Server 2008 R2 for development.
However client has reported few bugs which I am not able to reproduce on my machine but when I deploy same solution on Windows 7 or 10. It gives me…

Shaan
- 151
- 8
4
votes
2 answers
datagridview combobox list color changed to black c#
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
int n = dataGridView1.CurrentCell.RowIndex;
if (dataGridView1.CurrentCell.ColumnIndex == 0)
{
var…

babin raj
- 163
- 2
- 10