i have created datagridview dynamically with check box column,once i refresh my datagrid its removes all data except checkbox column,below code for adding checkbox column in datagrid
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add(chk);
chk.HeaderText = "Check Data";
chk.Name = "chk";
int count = dataGridView1.Rows.Count;
for (int i = 0; i < count; i++)
{
dataGridView1.Rows[i].Cells[12].Value = false;
}
and below code for clearing my datagrid,if i try to add new data in datagridview after refresh still old check box exists and it keeps adding one more checkbox column.
dataGridView1.Rows.Clear();
dataGridView1.Refresh();
any suggestion???
Loading

R J192 reputationPosted Aug 26, 2014, 8:32 PM EDT
Try this way
R J192 reputationPosted Aug 26, 2014, 9:07 PM EDT
If you can not obtain the same checkbox column object try remove the column using index value.
If this column is 5th column in datagrid then
datagrid.Columns.Remove(4)
Archana Palani28 reputationPosted Aug 26, 2014, 8:46 PM EDT
its throwing the following error
Archana Palani28 reputationPosted Aug 26, 2014, 10:29 PM EDT
vikas kumar36 reputationPosted Jul 2, 2017, 12:49 AM EDT
dataGridView1.Controls.Remove(ckBox);
}