Bagikan melalui


DataGridView.CellErrorTextChanged Kejadian

Definisi

Terjadi saat nilai ErrorText properti sel berubah.

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 

Jenis Acara

Contoh

Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan kemunculan CellErrorTextChanged peristiwa. Laporan ini membantu Anda mempelajari kapan peristiwa terjadi dan dapat membantu Anda dalam penelusuran kesalahan. Untuk melaporkan beberapa peristiwa atau peristiwa yang sering terjadi, pertimbangkan untuk mengganti MessageBox.Show dengan Console.WriteLine atau menambahkan pesan ke multibaris TextBox.

Untuk menjalankan kode contoh, tempelkan ke dalam proyek yang berisi instans jenis DataGridView bernama DataGridView1. Kemudian pastikan bahwa penanganan aktivitas dikaitkan dengan peristiwa.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

Keterangan

Untuk informasi selengkapnya tentang cara menangani peristiwa, lihat Menangani dan Menaikkan Peristiwa.

Berlaku untuk

Lihat juga