Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sometimes you will want to display only some of the columns that are available in a Windows Forms DataGridView control. For example, you may want to show an employee salary column to users with management credentials while hiding it from other users. Alternately, you may want to bind the control to a data source that contains many columns, only some of which you want to display. In this case, you will typically remove the columns you are not interested in displaying rather than hiding them. For more information, see How to: Add and Remove Columns in the Windows Forms DataGridView Control Using the Designer.
The following procedure requires a Windows Application project with a form containing a DataGridView control. For information about setting up such a project, see How to: Create a Windows Forms application project and How to: Add Controls to Windows Forms.
To hide a column using the designer
Click the designer actions glyph (
) on the upper-right corner of the DataGridView control, and then select Edit Columns.
Select a column from the Selected Columns list.
In the Column Properties grid, set the Visible property to
false
.Note
You can also hide a column when adding it by clearing the Visible check box in the Add Column dialog box.
See also
.NET Desktop feedback