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.
By default, users can modify text and numerical data displayed in the Windows Forms DataGridView control. If you want to display data that is not meant for modification, you must make the columns that contain the data read-only. For information about how to make the control entirely read-only, see How to: Prevent Row Addition and Deletion 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 make a column read-only by 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 ReadOnly property to
true
.Note
You can also make a column read-only when you add it by selecting the Read Only check box in the Add Column dialog box.
See also
- DataGridView
- DataGridViewColumn.ReadOnly
- How to: Add and Remove Columns in the Windows Forms DataGridView Control Using the Designer
- How to: Prevent Row Addition and Deletion in the Windows Forms DataGridView Control Using the Designer
- How to: Create a Windows Forms application project
- How to: Add Controls to Windows Forms
.NET Desktop feedback