problem hiding columns in a datagrid using vb.net 2003

problem hiding columns in a datagrid using vb.net 2003

Post by RmVkZXJpY2 » Thu, 03 Feb 2005 02:45:05


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.
 
 
 

problem hiding columns in a datagrid using vb.net 2003

Post by Not Aaro » Thu, 03 Feb 2005 03:05:28

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

 
 
 

problem hiding columns in a datagrid using vb.net 2003

Post by Andy O'Nei » Fri, 04 Feb 2005 01:49:25


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.

--
Regards,
Andy O'Neill