Udostępnij za pośrednictwem


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

When you enable column reordering in the DataGridView control, users can move a column to a new position by dragging the column header with the mouse. In the DataGridView control, the DataGridView.AllowUserToOrderColumns property value determines whether users can move columns to different positions.

There is support for this task in Visual Studio. How to: Enable Column Reordering in the Windows Forms DataGridView Control Using the Designer
How to: Enable Column Reordering in the Windows Forms DataGridView Control Using the Designer
How to: Enable Column Reordering in the Windows Forms DataGridView Control Using the Designer
How to: Enable Column Reordering in the Windows Forms DataGridView Control Using the Designer

To enable column reordering programmatically

Compiling the Code

This example requires:

See Also

Tasks

How to: Freeze Columns in the Windows Forms DataGridView Control

Reference

DataGridView

DataGridView.AllowUserToOrderColumns

Other Resources

Basic Column, Row, and Cell Features in the Windows Forms DataGridView Control