In my program after import an excel file to datagridview, each sheet have different index of column header which the 1st row is Total Qty & Net Value. I wanted to delete the Total Qty & Net Value column data. Have any ideas on how to achieve this? I tried to remove the column header, but most of it just hide not delete it.

enter image description here

I got an error using the code below because Total Qty is not column header.

for (int i = 1; i < dt.Rows.Count; i++)
{
 dt.Columns.Remove("TOTAL QTY"); //insert row?
}

0 Answers