
August 13th, 2003, 04:19 PM
|
|
Contributing User
|
|
Join Date: May 2003
Location: USA
Posts: 171
Time spent in forums: 42 m 58 sec
Reputation Power: 6
|
|
|
How To Hide Columns
Does anyone know how to hide columns of a Datagrid in a windows form (.NET)?
See this link below, how Microsoft confused developers:
http://msdn.microsoft.com/library/d...erControl. asp
===========================================
Showing and Hiding Columns Dynamically
One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column's Visible property. The following example shows how to toggle the visibility of the second column (index 1) of the grid:
' Visual Basic
DataGrid1.Columns(1).Visible = Not (DataGrid1.Columns(1).Visible)
// C#
DataGrid1.Columns[1].Visible = !(DataGrid1.Columns[1].Visible);
===============================
Any feedback will be appreciated.
|