DataGridView.TopLeftHeaderCell Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the header cell located in the upper left corner of the DataGridView control.
public:
property System::Windows::Forms::DataGridViewHeaderCell ^ TopLeftHeaderCell { System::Windows::Forms::DataGridViewHeaderCell ^ get(); void set(System::Windows::Forms::DataGridViewHeaderCell ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.DataGridViewHeaderCell TopLeftHeaderCell { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.TopLeftHeaderCell : System.Windows.Forms.DataGridViewHeaderCell with get, set
Public Property TopLeftHeaderCell As DataGridViewHeaderCell
The DataGridViewHeaderCell located at the upper left corner of the DataGridView.
- Attributes
The following code example uses this property to display a value in the upper-left corner of a DataGridView control. This value labels a child table in a master/detail scenario. This example is part of a larger example available in the DataGridViewComboBoxColumn class overview topic.
private:
void SetUpDataGridView2()
{
DataGridView2->Dock = DockStyle::Bottom;
DataGridView2->TopLeftHeaderCell->Value = "Sales Details";
DataGridView2->RowHeadersWidthSizeMode =
DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders;
}
private void SetUpDataGridView2()
{
DataGridView2.Dock = DockStyle.Bottom;
DataGridView2.TopLeftHeaderCell.Value = "Sales Details";
DataGridView2.RowHeadersWidthSizeMode =
DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
}
Private Sub SetUpDataGridView2()
DataGridView2.Dock = DockStyle.Bottom
DataGridView2.TopLeftHeaderCell.Value = "Sales Details"
DataGridView2.RowHeadersWidthSizeMode = _
DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders
End Sub
Setting this property allows you to set a value for the cell, associate a shortcut menu with it, or perform any other operations you can perform on a DataGridViewHeaderCell.
In applications designed for use with right-to-left languages, the cell represented by this property is typically in the upper-right corner.
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: