Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To eliminate a column from a DataGridView in C#, follow these steps:

  1. Select the DataGridView control on the form.
  2. Click on the Smart Tag icon.
  3. In the drop-down list, click on "Edit Columns".
  4. In the "DataGridView Columns" dialog box, select the column you want to eliminate.
  5. Click the "Remove" button.
  6. Click "OK" to close the dialog box.

Alternatively, you could use the following code snippet to remove a specific column from the DataGridView control:

dataGridView1.Columns.RemoveAt(1);    // Removes the second column (index 1)

The above code will remove the second column from the DataGridView control. You can replace "1" with the index of the column you want to eliminate.