2
Answers

Create a DataGridViewCheckBoxCell in a DataGridView

Romain

Romain

10y
1.1k
1
Good morning,
 
I contact you because I have a problem in my C# program.
I am using a basic DataGridView with 4 DataGridViewTextBoxColumn. And I would like to add a checkbox with a label in a specific cell of the data grid view at a specific position in the data grid view ( for example : Row[0], Col[0] )
 
I tried to do that :
DataGridViewCell ch1 = new DataGridViewCheckBoxCell(); 
this.dataGridView1.Rows[0].Cells[0] = ch1;
 
But it is not working and I have an exception concerning the type of the cell when I run the application.
First, I would like to know it the thing that I want to do is possible and then if someone have an idea to it.
 
Thank you in advance.

 
 
 
 

Answers (2)