DataGridView.CellStateChanged Event

 

Occurs when a cell state changes, such as when the cell loses or gains focus.

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

public event DataGridViewCellStateChangedEventHandler CellStateChanged

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

The following code example illustrates the use of this event.

private void dataGridView1_CellStateChanged(object sender,
    DataGridViewCellStateChangedEventArgs e)
{
    DataGridViewElementStates state = e.StateChanged;
    string msg = String.Format("Row {0}, Column {1}, {2}",
        e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged);
    MessageBox.Show(msg, "Cell State Changed");
}

.NET Framework
Available since 2.0
Return to top
Show: