I am binding a DataSet objetc as a datasource to my GridView. However i want to omit first column from being displayed.
If i write

GridView1.Columns(0).Visible = False

then i get error saying there was some indexing error.
How can this be acheived ???
Also a weird thing is that when I try to count columns it displays me count as 0 !! :O

something must be to check:

1.maybe you wrongly state the column.
it is the first column?
if it is the first column, i think your code have no problem.

2.the name of datagridview

3.else you can try this:

GridView1.Columns("nameofcolumn").Visible = False
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.