DataGridView.CellEndEdit イベント
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As DataGridView Dim handler As DataGridViewCellEventHandler AddHandler instance.CellEndEdit, handler
public: event DataGridViewCellEventHandler^ CellEndEdit { void add (DataGridViewCellEventHandler^ value); void remove (DataGridViewCellEventHandler^ value); }


以前に CellValidating イベント ハンドラによって行のDataGridViewRow.ErrorText が設定されていた場合、このイベントを処理してこのプロパティをクリアする方法を次のコード例に示します。CellValidating イベント ハンドラは、新しいセルの値が検証基準を満たしている場合にエラー テキストを消去できますが、ユーザーが Esc キーを押して古いセルの値に戻した場合、CellValidating イベントは発生しません。次の例は「チュートリアル : Windows フォーム DataGridView コントロールのデータの妥当性検査」で取り上げている例の一部です。
Private Sub dataGridView1_CellValidating(ByVal sender As Object, _ ByVal e As DataGridViewCellValidatingEventArgs) _ Handles dataGridView1.CellValidating ' Validate the CompanyName entry by disallowing empty strings. If dataGridView1.Columns(e.ColumnIndex).Name = "CompanyName" Then If String.IsNullOrEmpty(e.FormattedValue.ToString()) Then dataGridView1.Rows(e.RowIndex).ErrorText = _ "Company Name must not be empty" e.Cancel = True End If End If End Sub Private Sub dataGridView1_CellEndEdit(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _ Handles dataGridView1.CellEndEdit ' Clear the row error in case the user presses ESC. dataGridView1.Rows(e.RowIndex).ErrorText = String.Empty End Sub
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { // Validate the CompanyName entry by disallowing empty strings. if (dataGridView1.Columns[e.ColumnIndex].Name == "CompanyName") { if (String.IsNullOrEmpty(e.FormattedValue.ToString())) { dataGridView1.Rows[e.RowIndex].ErrorText = "Company Name must not be empty"; e.Cancel = true; } } } void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { // Clear the row error in case the user presses ESC. dataGridView1.Rows[e.RowIndex].ErrorText = String.Empty; }
private: void dataGridView1_CellValidating(Object^ /*sender*/, DataGridViewCellValidatingEventArgs^ e) { // Validate the CompanyName entry by disallowing empty strings. if (dataGridView1->Columns[e->ColumnIndex]->Name == "CompanyName") { if (e->FormattedValue->ToString() == String::Empty) { dataGridView1->Rows[e->RowIndex]->ErrorText = "Company Name must not be empty"; e->Cancel = true; } } } private: void dataGridView1_CellEndEdit(Object^ /*sender*/, DataGridViewCellEventArgs^ e) { // Clear the row error in case the user presses ESC. dataGridView1->Rows[e->RowIndex]->ErrorText = String::Empty; }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataGridView クラス
DataGridView メンバ
System.Windows.Forms 名前空間
その他の技術情報
DataGridView コントロール (Windows フォーム)
Weblioに収録されているすべての辞書からDataGridView.CellEndEdit イベントを検索する場合は、下記のリンクをクリックしてください。

- DataGridView.CellEndEdit イベントのページへのリンク