I'm showing data from database table into datagridview each column has a checkbox for example column named "Tel" has a check box "checkBox_Tel"
if (!checkBox_Tel.Checked)
{
dg.Columns.Remove("Tel");
}
when the user uncheck one , the column related to this check box is removed from the dgv
but i want to return that column when the user recheck it how can i do that?
If your intent is just to hide the column and then restore its visibility then
dg.Columns("Tel").Visible = checkBox_Tel.Checked
Use this property to hide a column from view while keeping the column in the DataGridView. To completely remove a column, use the DataGridViewColumnCollection.Remove method.