DataGridView.CellErrorTextChanged Zdarzenie

Definicja

Występuje, gdy zmienia się wartość ErrorText właściwości komórki.

public:
 event System::Windows::Forms::DataGridViewCellEventHandler ^ CellErrorTextChanged;
public event System.Windows.Forms.DataGridViewCellEventHandler CellErrorTextChanged;
public event System.Windows.Forms.DataGridViewCellEventHandler? CellErrorTextChanged;
member this.CellErrorTextChanged : System.Windows.Forms.DataGridViewCellEventHandler 
Public Custom Event CellErrorTextChanged As DataGridViewCellEventHandler 

Typ zdarzenia

Przykłady

W poniższym przykładzie kodu pokazano użycie tego elementu członkowskiego. W tym przykładzie program obsługi zdarzeń zgłasza wystąpienie CellErrorTextChanged zdarzenia. Ten raport pomaga dowiedzieć się, kiedy wystąpi zdarzenie, i może pomóc w debugowaniu. Aby zgłosić wiele zdarzeń lub często występujących zdarzeń, rozważ zastąpienie MessageBox.Show komunikatu ciągiem Console.WriteLine lub dołączenie go do wielowierszowego TextBoxelementu .

Aby uruchomić przykładowy kod, wklej go w projekcie zawierającym wystąpienie typu DataGridView o nazwie DataGridView1. Następnie upewnij się, że program obsługi zdarzeń jest skojarzony ze zdarzeniem CellErrorTextChanged .

private void DataGridView1_CellErrorTextChanged(Object sender, DataGridViewCellEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellErrorTextChanged Event" );
}
Private Sub DataGridView1_CellErrorTextChanged(sender as Object, e as DataGridViewCellEventArgs) _ 
     Handles DataGridView1.CellErrorTextChanged

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

End Sub

Uwagi

Aby uzyskać więcej informacji na temat obsługi zdarzeń, zobacz Obsługa i podnoszenie zdarzeń.

Dotyczy

Zobacz też