I open form,but the dataview ,the first cells ,can not checked. my code is below,i wanna all the checkboxcell is checked default.this code inside form_load. who have good idea. i have tested many ways.
DataGridView1.Refresh(); int count = Convert.ToInt32(DataGridView1.RowCount.ToString());
for (int i = 0; i < count; i++)
{
DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)DataGridView1.Rows[i].Cells[0];
checkCell.Value = true;
Boolean flag = Convert.ToBoolean(checkCell.Value);
if (flag == false)
{
checkCell.Value = true;
}
else
continue;
}
Aucun commentaire:
Enregistrer un commentaire