Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataGridViewColumn.Frozen Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a value indicating whether a column will move when a user scrolls the DataGridView control horizontally.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public override bool Frozen { get; set; }
/** @property */
public boolean get_Frozen ()

/** @property */
public void set_Frozen (boolean value)

public override function get Frozen () : boolean

public override function set Frozen (value : boolean)

Property Value

true to freeze the column; otherwise, false.

When a column is frozen, all the columns to its left (or to its right in right-to-left languages) are frozen as well. The frozen and unfrozen columns form two groups. If column repositioning is enabled by setting the AllowUserToOrderColumns property to true, the user cannot drag a column from one group to the other.

The following code example demonstrates how to use the DataGridViewBand.Frozen property, which is nearly identical to the Frozen property of the DataGridViewColumn class. This code example is part of a larger example provided for the DataGridViewBand class.

// Freeze the first row.
private void Button4_Click(object sender, System.EventArgs e)
{

    FreezeBand(dataGridView.Rows[0]);
}

private void Button5_Click(object sender, System.EventArgs e)
{

    FreezeBand(dataGridView.Columns[1]);
}

private static void FreezeBand(DataGridViewBand band)
{
    band.Frozen = true;
    DataGridViewCellStyle style = new DataGridViewCellStyle();
    style.BackColor = Color.WhiteSmoke;
    band.DefaultCellStyle = style;
}

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.