Collapse the table of content
Expand the table of content
Expand Minimize

DataGridView.CurrentCellChanged Event


Occurs when the CurrentCell property changes.

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

public event EventHandler CurrentCellChanged

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)
    oldRowIndex = this.dataGridView1.CurrentCellAddress.Y;

.NET Framework
Available since 2.0
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft