DataGridView - add items

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have an DataGridView control with the following columns (added using the
designer):
column1 - DataGridViewTextBoxColumn
column2 - DataGridViewComboBoxColumn (values "test1", "test2")
column3 - DataGridViewCheckBoxColumn

How can I add a row, that the item "test2" is selected ("column2")?
How can I set a cell to readonly?

Christian
 
Hi,

I have an DataGridView control with the following columns (added using the
designer):
column1 - DataGridViewTextBoxColumn
column2 - DataGridViewComboBoxColumn (values "test1", "test2")
column3 - DataGridViewCheckBoxColumn

How can I add a row, that the item "test2" is selected ("column2")?
How can I set a cell to readonly?

Christian

I haven't used a DataGridView in quite some time but if I'm not
mistaken, setting a cell as ReadOnly is done by doing something like:

dgv.Rows[0].Cells[0].ReadOnly = true; // set first cell of first row
to readonly

I believe the combobox column can be set by changing the Cells.Value
property
 
Back
Top