Checkboxes in datagridview
-
Hi, I have an unbound DataGridView which I have added two columns to (in the designer): one DataGridViewTextBoxColumn and one DataGridViewCheckBoxColumn. Now I want to add rows to the DataGridView and be able to check and uncheck the cells under the DataGridViewCheckBoxColumn. I use the following code to add a new row but I can't get it to work. int rowIndex = myDataGridView.Rows.Add(); DataGridViewRow row = myDataGridView.Rows[rowIndex]; row.Cells["columnText"].Value = "some text"; row.Cells["columnCheckBox"].Value = true; Anyone knows how I can get this to work? /thanks
-
Hi, I have an unbound DataGridView which I have added two columns to (in the designer): one DataGridViewTextBoxColumn and one DataGridViewCheckBoxColumn. Now I want to add rows to the DataGridView and be able to check and uncheck the cells under the DataGridViewCheckBoxColumn. I use the following code to add a new row but I can't get it to work. int rowIndex = myDataGridView.Rows.Add(); DataGridViewRow row = myDataGridView.Rows[rowIndex]; row.Cells["columnText"].Value = "some text"; row.Cells["columnCheckBox"].Value = true; Anyone knows how I can get this to work? /thanks
-
First Of all thay "Nice" to add rows or handle them :
Object[] Row = { false }; dataGridView1.Rows.Add(Row);
Just Set the Propery of Enable Editing Adn Thats it :)Have Fun Never forget it
-
First Of all thay "Nice" to add rows or handle them :
Object[] Row = { false }; dataGridView1.Rows.Add(Row);
Just Set the Propery of Enable Editing Adn Thats it :)Have Fun Never forget it
-
When U Add A DataGridViewColumn See That The Enable Edting Property is Set To True Then To Add Rows Do THis : value toCol1Row1 = .... value toCol2Row1 = .... value toCol3Row1 = .... Where value ( int, string...) Gather all of the Variables to an Object array Object [] Row1 = {toCol1Row1 ,toCol2Row1 ,toCol3Row1 }; Add it to the DataGrdiView DataGrdiView.Rows.Add(Row1); While in your App u need to set the value of the CheckBox Column to either true/false bool toCheckBoxColumn = true; Object [] Row1 = {... ,toCheckBoxColumn ,... };
Have Fun Never forget it