DataGridView.CellStateChanged Événement

Définition

Se produit lorsque l'état d'une cellule change, par exemple perte ou obtention du focus.

public:
 event System::Windows::Forms::DataGridViewCellStateChangedEventHandler ^ CellStateChanged;
public event System.Windows.Forms.DataGridViewCellStateChangedEventHandler CellStateChanged;
member this.CellStateChanged : System.Windows.Forms.DataGridViewCellStateChangedEventHandler 
Public Custom Event CellStateChanged As DataGridViewCellStateChangedEventHandler 

Type d'événement

DataGridViewCellStateChangedEventHandler

Exemples

L’exemple de code suivant illustre l’utilisation de cet événement.

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");
}
Private Sub dataGridView1_CellStateChanged(ByVal sender As Object, _
    ByVal e As DataGridViewCellStateChangedEventArgs) _
    Handles dataGridView1.CellStateChanged

    Dim state As DataGridViewElementStates = e.StateChanged
    Dim msg As String = String.Format( _
        "Row {0}, Column {1}, {2}", _
        e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged)
    MessageBox.Show(msg, "Cell State Changed")

End Sub

Remarques

Pour plus d’informations sur la façon de gérer les événements, consultez gestion et déclenchement d’événements.

S’applique à

Voir aussi