datagridviewcomboboxcell

Error trying to rebind DataSource to DataGridViewComboBoxCell?

I have a DataGridView with two DataGridViewComboBoxColumns. I want to use the selected item in the first column to trigger a re-population of the items in the second column, on a per-row basis. Here's the code I have so far. "addlInfoParentCat" identifies the first column, and currentRow.Cells.Item(1) is the DataGridViewComboBoxCell t...

How to switch between DataGridViewTextBoxCell and DataGridViewComboBoxCell?

I want to have a DataGridView that has two columns. The first column will always be of type DataGridViewComboBoxColumn. Based on the selection in that column, I'd like to be able to change the corresponding cell in the second column to either a DataGridViewComboBoxCell or a DataGridViewTextBoxCell. I'm thinking I just need to make the...

Setting default value to a DataGridViewComboBoxCell

The combobox displays a blank field by default even though the combobox is populated with a number of values ColumnSpeed.DataSource = speedList; ColumnSpeed.ValueType = typeof(string); I also tried the following, but it still displays the blank text. foreach (DataGridViewRow row in myDataGridView.Rows) { DataGridViewComboBoxCell ...

.NET DataGridViewComboBoxCell behaviour on losing focus

I have a DataGridView bound to a DataTable. Once the binding is done, I manually search through all the cells of the DGV and replace a single regular DGV cell with a DataGridViewComboBoxCell instance. The cell has its own data source bound to it. The problem I'm having is that when the user makes a selection in the DataGridViewComboBoxC...

C# DataGridViewComboBoxCell setting value manually, value not valid

Hi, here is my code: private class Person { private string myName; private int myValue; public Person(string name, int value) { myName = name; myValue = value; } public override string ToString() { ...

How to set a single ComboBoxCell in a TextBoxCell column of DataGridView?

I have a DataGridView with two columns defined like: Dim col As New DataGridViewColumn col.DefaultCellStyle.BackColor = Color.FromArgb(&HFFAAAAAA) col.Name = "Description" col.MinimumWidth = 80 col.DataPropertyName = "Description" col.ValueType = GetType(String) col.ReadOnly = True col.CellTemplate = New DataGridViewTextBoxCell S0Grid.C...

DataSource mysteriously changing

I have a DataGridView with a DataGridViewComboBoxCell. In the gv.EditingControlShowing handler, I am setting the DataSource of the DataGridViewComboBoxCell. I also have the gv.CellValidating event wired to a handler. When I check the DataSource of the DataGridViewComboBoxCell, it is different than what I set it to in the CellValidatin...

How can I change the color of a DataGridViewComboBoxCell in the CellFormatting event?

private void CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if(whatever) e.CellStyle.BackColor = SystemColors.ControlDark; This works fine for text columns but for combo box columns it makes no difference. I'd just as soon not make an owner draw control if there's a simpler way to do this. Thanks, Spike ...