DataGridView.CurrentCellChanged Event
.NET Framework (current version)
Occurs when the CurrentCell property changes.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
For more information about handling events, see NIB: Consuming Events.
The following code example illustrates the use of this event. This example is part of a larger example available in How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control.
// Forces the row to repaint itself when the user changes the // current cell. This is necessary to refresh the focus rectangle. void dataGridView1_CurrentCellChanged(object sender, EventArgs e) { if (oldRowIndex != -1) { this.dataGridView1.InvalidateRow(oldRowIndex); } oldRowIndex = this.dataGridView1.CurrentCellAddress.Y; }
.NET Framework
Available since 2.0
Available since 2.0
Show: