Questions tagged [datagridviewcombobox]

263 questions
2
votes
1 answer

DataGridViewComboBoxColumn: limit MaxDropDownItems

I would like to know how to limit the number of items to show in DataGridViewComboBoxColumn. In simple ComboBox we can do it as: comboBox1.IntegralHeight = false; //this is necessary to make it work!!! comboBox1.MaxDropDownItems = 3; But how to do…
Mitja Bonca
  • 4,268
  • 5
  • 24
  • 30
2
votes
1 answer

WinForms DatagridViewComboboxColumn "enter key"

I have a datagridview with an editable combobox column, but everytime I press "Enter" on the current combobox, the text I'm writing disappears. private void dgView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if…
user962284
  • 670
  • 1
  • 12
  • 29
2
votes
1 answer

What happen to DataGridViewComboBoxColumn when DisplayMember is set?

When I have a DataGridViewComboBoxColumn filled with binded values, and if I set the DisplayMember property, I get the DataError event raised with a FormatException: DataGridViewComboBoxCell value is not valid If DisplayMember is not set, and so…
Cyril Gandon
  • 16,830
  • 14
  • 78
  • 122
2
votes
1 answer

Can i use DataGridViewComboBoxColumn to display a list of class objects?

I am trying to populate a DataGridViewComboBoxColumn with a list of class objects ( With ToString overloaded). This method has worked perfectly for me for regular combo boxes. However once I load the DataGridViewComboBoxColumn into the dataGridView…
Matt Osborne
  • 93
  • 1
  • 2
  • 6
2
votes
1 answer

DataGridViewComboBoxColumn setting selected index

I just cant get this to work. I have a datagridview in winforms and in this one of my columns is a DataGridViewComboBoxColumn. In my constructor I set it up like so DataGridViewComboBoxColumn column =…
2
votes
1 answer

How to populate DataGridView with textbox and combobox with comboboxcells having different value lists

I have three columns , textbox, combobox and textbox in that order: this.columnLocalName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnLocalAddress = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.columnLocalPort =…
1
vote
0 answers

How to disable the DataGridViewComboBox in DataGridview?

Hi Programmers! I need to disable the DataGridViewComboBoxCell if the certain conditions get true. Thanks in advance.
Prakash Kunwar
  • 797
  • 4
  • 14
  • 28
1
vote
4 answers

Value doesn't show up on a DataGridViewComboBox control

After setting the values in the DataGridView, they don't show up on the control even though I can access them through the Value property. The problem is that there is no default Value in the ComboBox cells. void ComboBoxColumn() { string[]…
mooper
  • 166
  • 1
  • 2
  • 10
1
vote
1 answer

Adding Bitmap or Icon to a cell in DataGridViewComboBoxColumn

I would like to have a combo box that contains 3 small Icons or Bitmaps, I dont mind which. I have tried the following code to add 1 image: DataGridViewComboBoxColumn statusColumn = new DataGridViewComboBoxColumn(); Icon greenIcon = new…
maffo
  • 1,393
  • 4
  • 18
  • 35
1
vote
2 answers

"DataGridViewComboBoxCell value is not valid." Property DataSource

I have a method that updates a column that contains a type DataGridViewComboBoxCell, early ComboBoxCell is empty, select a product and ComboBoxCell is updated when adding a new record is done well, but when I modify it sends an exception : …
ch2o
  • 815
  • 2
  • 12
  • 29
1
vote
1 answer

DataGridViewTextBoxColumn that changes to ComboBox on editing

I want to show a DataGridView with a ComboBox column that looks like a DataGridViewTextBoxColumn. In DataGridView I have the DataGridViewTextBoxColumn displayed and when the user sets Focus on a cell in this column, the cell should be changed to…
Robert
  • 2,571
  • 10
  • 63
  • 95
1
vote
0 answers

System.FormatException when populating a DataGridViewComboBoxColumn from SQL Query

Context: I have a datagridview with one combobox columns called Media. This combobox got two possible values: TV and RADIO. I populate this column with datas coming from SQL Query where the SQL field queried got two possible values: TV and…
8oris
  • 320
  • 2
  • 12
1
vote
1 answer

System.ArgumentException when trying to use DataGridViewComboBox and ValueMember

ModelLinkControl modelLinkControl = new ModelLinkControl(); modelLinkControl.bindingSourceCModels.DataSource = cModels; modelLinkControl.bindingSourceAModels.DataSource = aModels; modelLinkControl.bindingSourceModelLinks.DataSource =…
1
vote
3 answers

Get DataGridViewComboboxColumn SelectedValue (VB.Net)

I need to get the selected value of a ComboBox in a DataGridView. I have it partially working, but I get a Null Reference Exception if I change a another ComboBox in the grid. Here's my code: Private Sub dgvSampleList_EditingControlShowing(ByVal…
Peter
  • 11
  • 1
  • 1
  • 2
1
vote
1 answer

Datagridview DatagridviewComboboxColumn Editing DataBound

I have a datagridview with a datagridviewcomboboxcolumn on which I enabled editing. This works as long as no datapropertyname is set for the column. when the datapropertyname is set and i'm typing in the combobox the item is suggested as it should,…
Michiel Alders
  • 69
  • 1
  • 2
  • 15