Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

How to: Freeze Columns in the Windows Forms DataGridView Control Using the Designer 

When users view data displayed in a Windows Forms DataGridView control, they sometimes need to refer to a single column or set of columns frequently. For example, when you display a table of customer information that contains many columns, it is useful for you to display the customer name at all times while enabling other columns to scroll outside the visible region.

To achieve this behavior, you can freeze columns in the control. When you freeze a column, all the columns to its left (or to its right in right-to-left language scripts) are frozen as well. Frozen columns remain in place while all other columns can scroll. If column reordering is enabled, the frozen columns are treated as a group distinct from the unfrozen columns. Users can reposition columns in either group, but they cannot move a column from one group to the other.

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 Application Project and How to: Add Controls to Windows Forms.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To freeze a column using the designer

  1. Choose Edit Columns from the control's smart tag.

  2. Select a column from the Selected Columns list.

  3. In the Column Properties grid, set the Frozen property to true.

    NoteNote

    You can also freeze a column when adding it by selecting the Frozen box in the Add Column dialog box.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.