How to: Enable Column Reordering in the Windows Forms DataGridView Control Using the Designer

When viewing data displayed in a Windows Forms DataGridView control, users sometimes want to compare the values in specific columns. This can be inconvenient if the columns are widely separated in the control, especially if users must scroll back and forth horizontally in order to see all the columns they are interested in. You can make the task of comparing column values easier by enabling your users to reorder the columns. When you enable column reordering, users can move a column to a new position by dragging the column header with the mouse.

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

Note

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 Working with Settings.

To enable column reordering

  • Click the smart tag glyph (Smart Tag Glyph) on the upper-right corner of the DataGridView control, and then select Enable Column Reordering.

See Also

Tasks

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

How to: Create a New Windows Forms Application Project

How to: Add Controls to Windows Forms

Reference

DataGridView

DataGridView.AllowUserToOrderColumns