I am strugling with a problem with DataGridView and DataGridViewComboBoxCell in C# (Visual Studio 2013, .NET 4.5.1)
The DataGridView has 3 columns with DataGridViewComboBoxColumn and 3 columns with DataGridViewTextBoxColumn.
The DataGrid is bound to a DataTable
I need to set the readonly property individually for each cell:
For existing rows: Only the last cell (DataGridViewTextBoxCell) shall be editable.
When adding new row, all cells except two textbox cells shall be editable.
My problem is that the end user can still change the selection of the DataGridViewComboBoxCells even when ReadOnly = true;
Setting ReadOnly=true on DataGridViewTextBoxCells works fine
Setting ReadOnly=true on DataGridViewComboBoxCell has no effect. When writing out the ReadOnly property, it returns true, but the cell is still editable.
You can use a similar code in your
DataGridView.CellBeginEdit
: