DataGridView.RowHeaderMouseClick Event

 

Occurs when the user clicks within the boundaries of a row header.

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

public event DataGridViewCellMouseEventHandler RowHeaderMouseClick

For more information about handling events, see NIB: Consuming Events.

The following code example illustrates the use of this event.

void dataGridView1_ColumnHeaderMouseClick(
    object sender, DataGridViewCellMouseEventArgs e)
{
    this.dataGridView1.SelectionMode =
        DataGridViewSelectionMode.ColumnHeaderSelect;
    this.dataGridView1.Columns[e.ColumnIndex].HeaderCell
        .SortGlyphDirection = SortOrder.None;
    this.dataGridView1.Columns[e.ColumnIndex].Selected = true;
}

void dataGridView1_RowHeaderMouseClick(
    object sender, DataGridViewCellMouseEventArgs e)
{
    this.dataGridView1.SelectionMode =
        DataGridViewSelectionMode.RowHeaderSelect;
    this.dataGridView1.Rows[e.RowIndex].Selected = true;
}

.NET Framework
Available since 2.0
Return to top
Show: