Training
Module
Create and manage columns within a table in Microsoft Dataverse - Training
Learn how to create and manage table columns in Dataverse.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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 displaying a table of customer information that contains many columns, it is useful 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.
Note
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 Frozen property of a column determines whether the column is always visible within the grid.
There is support for this task in Visual Studio. Also see How to: Freeze Columns in the Windows Forms DataGridView Control Using the Designer.
Set the DataGridViewColumn.Frozen property to true
.
this.dataGridView1.Columns["AddToCartButton"].Frozen = true;
Me.dataGridView1.Columns("AddToCartButton").Frozen = True
This example requires:
A DataGridView control named dataGridView1
that contains a column named AddToCartButton
.
References to the System and System.Windows.Forms assemblies.
.NET Desktop feedback feedback
.NET Desktop feedback is an open source project. Select a link to provide feedback:
Training
Module
Create and manage columns within a table in Microsoft Dataverse - Training
Learn how to create and manage table columns in Dataverse.
Documentation
Get and Set the Current Cell in DataGridView Control - Windows Forms .NET Framework
Learn how to programmatically discover which cell is currently active by getting and setting the current cell in the Windows Forms DataGridView control.
Change the Order of Columns in DataGridView Control - Windows Forms .NET Framework
Learn how to change the order of columns in the Windows Forms DataGridView control by using the DisplayIndex property.
Column Fill Mode in DataGridView Control - Windows Forms .NET Framework
Learn how the Windows Forms DataGridView control in column fill mode resizes its columns automatically so that they fill the width of the available display area.