This documentation is archived and is not being maintained.

DataGridViewButtonColumn.UseColumnTextForButtonValue Property

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

Gets or sets a value indicating whether the Text property value is displayed as the button text for cells in this column.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public bool UseColumnTextForButtonValue { get; set; }
/** @property */
public boolean get_UseColumnTextForButtonValue ()

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

public function get UseColumnTextForButtonValue () : boolean

public function set UseColumnTextForButtonValue (value : boolean)

Property Value

true if the Text property value is displayed on buttons in the column; false if the FormattedValue property value of each cell is displayed on its button. The default is false.

Exception typeCondition


The value of the CellTemplate property is a null reference (Nothing in Visual Basic).

By default, the DataGridViewCell.FormattedValue of a button cell is displayed as the text on the button. The UseColumnTextForButtonValue property allows you to either set the button text for each cell, or to use the Text property value for all of the button cells.

Getting or setting this property gets or sets the UseColumnTextForButtonValue property of the object returned by the CellTemplate property. Setting this property also sets the UseColumnTextForButtonValue property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value.

The following code example demonstrates the use of this property.

private void CreateUnboundButtonColumn()
    // Initialize the button column.
    DataGridViewButtonColumn buttonColumn =
        new DataGridViewButtonColumn();
    buttonColumn.Name = "Details";
    buttonColumn.HeaderText = "Details";
    buttonColumn.Text = "View Details";

    // Use the Text property for the button text for all cells rather
    // than using each cell's value as the text for its own button.
    buttonColumn.UseColumnTextForButtonValue = true;

    // Add the button column to the control.
    dataGridView1.Columns.Insert(1, buttonColumn);

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