Remove Column from DataGridView

TedN

Freshman
Joined
Sep 25, 2006
Messages
35
Is there a way to remove a column from a DataGridView.

I fill the datagridview from a dataset. The dataset has a column of data that I no longer require.

I've tried getting rid of the column in the dataset without success.
ds.Tables("Asset").Columns(6).Dispose() doesn't appear to do anything.

So I then tried to remove the column from the datagridview.

I've tried:
dgPrio.Columns.Remove("CLASS")
dgPrio.Columns.RemoveAt("CLASS")

and various other combinations.

All that happens is the column I wish to remove moves to the end.

Appreciate any help.


Thanks,
Ted
 
Duh!

I was removing column before making datagridview visible.

Make it visible first and column can be removed.
 
Not that I'm trying to deny the fact but I have never thought there's any relation between the visibility and the columns of a datagridview.

Weird. :p
 
Back
Top