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.
This topic provides links to DataGridView-related code examples available in the documentation.
![]() |
---|
A link always jumps to the top of the topic in which the code example is found. |
Additional code examples are available in the class library reference documentation. For a list of the principal classes and interfaces associated with the DataGridView control, see the table in DataGridView Control Technology Summary (Windows Forms).
Unbound Data Examples
How to: Add an Unbound Column to a Data-Bound Windows Forms DataGridView Control
How to: Create an Unbound Windows Forms DataGridView Control
Walkthrough: Creating an Unbound Windows Forms DataGridView Control
Data Binding Examples
How to: Autogenerate Columns in a Data-Bound Windows Forms DataGridView Control
How to: Remove Autogenerated Columns from a Windows Forms DataGridView Control
How to: Access Objects Bound to Windows Forms DataGridView Rows
How to: Create a Master/Detail Form Using Two Windows Forms DataGridView Controls
Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls
Data Formatting Examples
How to: Format Data in the Windows Forms DataGridView Control
How to: Customize Data Formatting in the Windows Forms DataGridView Control
Data Validation Examples
How to: Validate Data in the Windows Forms DataGridView Control
Walkthrough: Validating Data in the Windows Forms DataGridView Control
How to: Handle Errors That Occur During Data Entry in the Windows Forms DataGridView Control
Walkthrough: Handling Errors that Occur During Data Entry in the Windows Forms DataGridView Control
Appearance Customization Examples
How to: Change the Border and Gridline Styles in the Windows Forms DataGridView Control
How to: Set Font and Color Styles in the Windows Forms DataGridView Control
How to: Set Default Cell Styles for the Windows Forms DataGridView Control
How to: Use the Row Template to Customize Rows in the Windows Forms DataGridView Control
How to: Set Alternating Row Styles for the Windows Forms DataGridView Control
Behavior Customization Examples
How to: Specify the Edit Mode for the Windows Forms DataGridView Control
How to: Specify Default Values for New Rows in the Windows Forms DataGridView Control
How to: Prevent Row Addition and Deletion in the Windows Forms DataGridView Control
How to: Perform a Custom Action Based on Changes in a Cell of a Windows Forms DataGridView Control
How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control
How to: Display Images in Cells of the Windows Forms DataGridView Control
How to: Customize Sorting in the Windows Forms DataGridView Control
Column Manipulation Examples
How to: Freeze Columns in the Windows Forms DataGridView Control
How to: Enable Column Reordering in the Windows Forms DataGridView Control
How to: Change the Order of Columns in the Windows Forms DataGridView Control
How to: Hide Columns in the Windows Forms DataGridView Control
How to: Hide Column Headers in the Windows Forms DataGridView Control
How to: Make Columns Read-Only in the Windows Forms DataGridView Control
How to: Set the Sort Modes for Columns in the Windows Forms DataGridView Control
How to: Work with Image Columns in the Windows Forms DataGridView Control
How to: Manipulate Columns in the Windows Forms DataGridView Control
Row and Column Sizing Examples
How to: Set the Sizing Modes of the Windows Forms DataGridView Control
How to: Programmatically Resize Cells to Fit Content in the Windows Forms DataGridView Control
How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control
Selection Examples
How to: Set the Selection Mode of the Windows Forms DataGridView Control
How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control
How to: Get and Set the Current Cell in the Windows Forms DataGridView Control
Advanced Customization Examples
How to: Customize the Appearance of Cells in the Windows Forms DataGridView Control
How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control
How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control
Advanced Data Examples
How to: Implement Virtual Mode in the Windows Forms DataGridView Control
Walkthrough: Implementing Virtual Mode in the Windows Forms DataGridView Control
Implementing Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control