DataGridViewRowStateChangedEventArgs.StateChanged Proprietà

Definizione

Ottiene lo stato modificato nella riga.

public:
 property System::Windows::Forms::DataGridViewElementStates StateChanged { System::Windows::Forms::DataGridViewElementStates get(); };
public System.Windows.Forms.DataGridViewElementStates StateChanged { get; }
member this.StateChanged : System.Windows.Forms.DataGridViewElementStates
Public ReadOnly Property StateChanged As DataGridViewElementStates

Valore della proprietà

Uno dei valori DataGridViewElementStates che indica lo stato modificato nella riga.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro. Nell'esempio un gestore eventi segnala l'occorrenza dell'evento DataGridView.RowStateChanged . Questo report consente di apprendere quando si verifica l'evento e può essere utile per eseguire il debug. Per segnalare più eventi o eventi che si verificano spesso, è consigliabile sostituire MessageBox.Show con Console.WriteLine o aggiungere il messaggio a una multilinea TextBox.

Per eseguire il codice di esempio, incollarlo in un progetto contenente un'istanza di tipo DataGridView denominata DataGridView1. Assicurarsi quindi che il gestore eventi sia associato all'evento DataGridView.RowStateChanged .

private void DataGridView1_RowStateChanged(Object sender, DataGridViewRowStateChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Row", e.Row );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "StateChanged", e.StateChanged );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowStateChanged Event" );
}
Private Sub DataGridView1_RowStateChanged(sender as Object, e as DataGridViewRowStateChangedEventArgs) _ 
     Handles DataGridView1.RowStateChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Row", e.Row)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "StateChanged", e.StateChanged)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RowStateChanged Event")

End Sub

Si applica a

Vedi anche