problem hiding columns in a datagrid using vb.net 2003

G

Guest

I made a form with a datagrid called MyDG. The datagrid has a typed dataset
as datasource (MyDS).

I put the following code in the load event of the form to hide the id column:

MyDS.MasterTable.IDColumn.ColumnMapping = MappingType.Hidden

Strangely, when the datagrid appears for the first time, the id column is
visible, then, when I expand a row, click to visualize then details and click
in the back button to see the master again, the id column is correctly hidden.
 
N

Not Aaron

You could always just set the column width to zero. The user isn't
able to expand that column when the width is zero. hth
 
A

Andy O'Neill

Not Aaron said:
You could always just set the column width to zero. The user isn't
able to expand that column when the width is zero. hth
But the cursor can tab into the zero width column - so you might want to
handle that issue.
An alternative is to use a tablestyle and just not have the id field in your
list.
This is my preferred method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top