This documentation is archived and is not being maintained.

DataGridTableStyle.RowHeaderWidth Property

Gets or sets the width of row headers.

[Visual Basic]
Public Property RowHeaderWidth As Integer
public int RowHeaderWidth {get; set;}
public: __property int get_RowHeaderWidth();
public: __property void set_RowHeaderWidth(int);
public function get RowHeaderWidth() : int;
public function set RowHeaderWidth(int);

Property Value

The width of row headers in pixels.


When row headers are visible a plus sign is displayed in each row header if the underlying data has a related child table.

This property will not function until you add DataGridTableStyle objects to the GridTableStylesCollection. Until then, setting this property will have no effect.


[Visual Basic] 
Private Sub CallEventLoader()
   AddHandler Load, AddressOf DataGridTableStyle_RowHeaderWidth_Load
End Sub 'CallEventLoader

Public Sub AttachRowHeaderWidthChanged()
   AddHandler myDataGridTableStyle.RowHeaderWidthChanged, AddressOf MyDelegateRowHeaderChanged
End Sub 'AttachRowHeaderWidthChanged

Public Sub MyDelegateRowHeaderChanged(sender As Object, e As EventArgs)
   MessageBox.Show("Row header width is changed")
End Sub 'MyDelegateRowHeaderChanged

Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click
   myDataGridTableStyle.RowHeaderWidth = 30
End Sub 'button1_Click

Private Sub button2_Click(sender As Object, e As EventArgs) Handles button2.Click
   MessageBox.Show("Row header width is: " & myDataGridTableStyle.RowHeaderWidth)
End Sub 'button2_Click

private void CallEventLoader()
   this.Load += new EventHandler(

public void AttachRowHeaderWidthChanged()
   myDataGridTableStyle.RowHeaderWidthChanged += 
                            new EventHandler(MyDelegateRowHeaderChanged);
public void MyDelegateRowHeaderChanged(object sender, EventArgs e)
   MessageBox.Show("Row header width is changed");

private void button1_Click(object sender, System.EventArgs e)
   myDataGridTableStyle.RowHeaderWidth = 30;

private void button2_Click(object sender, System.EventArgs e)
   MessageBox.Show("Row header width is: " + 

    void CallEventLoader() {
        this->Load += new EventHandler(this, 

    void AttachRowHeaderWidthChanged() {
        myDataGridTableStyle->RowHeaderWidthChanged += 
            new EventHandler(this, &DataGridTableStyle_RowHeaderWidth::MyDelegateRowHeaderChanged);

    void MyDelegateRowHeaderChanged(Object* /*sender*/, EventArgs* /*e*/) {
        MessageBox::Show(S"Row header width is changed");

    void button1_Click(Object* /*sender*/, System::EventArgs* /*e*/) {
        myDataGridTableStyle->RowHeaderWidth = 30;

    void button2_Click(Object* /*sender*/, System::EventArgs* /*e*/) {
        MessageBox::Show(String::Concat(S"Row header width is: ",
            __box( myDataGridTableStyle->RowHeaderWidth)));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DataGridTableStyle Class | DataGridTableStyle Members | System.Windows.Forms Namespace | RowHeadersVisibleChanged | RowHeadersVisible | RowHeaderWidthChanged