DataGridViewRow.ErrorText プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewRow.ErrorText プロパティの意味・解説 

DataGridViewRow.ErrorText プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

行レベルのエラーのエラー メッセージ テキストを取得または設定します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As DataGridViewRow
Dim value As String

value = instance.ErrorText

instance.ErrorText = value
public string ErrorText { get;
 set; }
/** @property */
public String get_ErrorText ()

/** @property */
public void set_ErrorText (String value)

プロパティ値
エラー メッセージを含む String。

例外例外
例外の種類条件

InvalidOperationException

このプロパティの値の取得時に、行が DataGridView コントロール内の共有行です。

解説解説
使用例使用例

ErrorText プロパティを DataError イベント ハンドラで使用する方法を、次のコード例に示します。この例は DataGridViewComboBoxColumn クラスの概要で取り上げているコード例の一部です。

Private Sub DataGridView1_DataError(ByVal
 sender As Object, _
ByVal e As DataGridViewDataErrorEventArgs)
 _
Handles DataGridView1.DataError

    MessageBox.Show("Error happened " _
        & e.Context.ToString())

    If (e.Context = DataGridViewDataErrorContexts.Commit) _
        Then
        MessageBox.Show("Commit error")
    End If
    If (e.Context = DataGridViewDataErrorContexts _
        .CurrentCellChange) Then
        MessageBox.Show("Cell change")
    End If
    If (e.Context = DataGridViewDataErrorContexts.Parsing) _
        Then
        MessageBox.Show("parsing error")
    End If
    If (e.Context = _
        DataGridViewDataErrorContexts.LeaveControl) Then
        MessageBox.Show("leave control error")
    End If

    If (TypeOf (e.Exception) Is
 ConstraintException) Then
        Dim view As DataGridView = CType(sender,
 DataGridView)
        view.Rows(e.RowIndex).ErrorText = "an error"
        view.Rows(e.RowIndex).Cells(e.ColumnIndex) _
            .ErrorText = "an error"

        e.ThrowException = False
    End If
End Sub
private void DataGridView1_DataError(object
 sender, DataGridViewDataErrorEventArgs anError)
{

    MessageBox.Show("Error happened " + anError.Context.ToString());

    if (anError.Context == DataGridViewDataErrorContexts.Commit)
    {
        MessageBox.Show("Commit error");
    }
    if (anError.Context == DataGridViewDataErrorContexts.CurrentCellChange)
    {
        MessageBox.Show("Cell change");
    }
    if (anError.Context == DataGridViewDataErrorContexts.Parsing)
    {
        MessageBox.Show("parsing error");
    }
    if (anError.Context == DataGridViewDataErrorContexts.LeaveControl)
    {
        MessageBox.Show("leave control error");
    }

    if ((anError.Exception) is ConstraintException)
    {
        DataGridView view = (DataGridView)sender;
        view.Rows[anError.RowIndex].ErrorText = "an error";
        view.Rows[anError.RowIndex].Cells[anError.ColumnIndex].ErrorText = "an
 error";

        anError.ThrowException = false;
    }
}
private:
    void DataGridView1_DataError(Object^ sender, DataGridViewDataErrorEventArgs^
 anError)
    {

        MessageBox::Show("Error happened " + anError->Context.ToString());

        if (anError->Context == DataGridViewDataErrorContexts::Commit)
        {
            MessageBox::Show("Commit error");
        }
        if (anError->Context == DataGridViewDataErrorContexts::CurrentCellChange)
        {
            MessageBox::Show("Cell change");
        }
        if (anError->Context == DataGridViewDataErrorContexts::Parsing)
        {
            MessageBox::Show("parsing error");
        }
        if (anError->Context == DataGridViewDataErrorContexts::LeaveControl)
        {
            MessageBox::Show("leave control error");
        }

        if (dynamic_cast<ConstraintException^>(anError->Exception)
 != nullptr)
        {
            DataGridView^ view = (DataGridView^)sender;
            view->Rows[anError->RowIndex]->ErrorText = "an error";
            view->Rows[anError->RowIndex]->Cells[anError->ColumnIndex]->ErrorText
 = "an error";

            anError->ThrowException = false;
        }
    }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewRow クラス
DataGridViewRow メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewCell.ErrorText プロパティ
DataGridView.DataError イベント
DataGridView.RowErrorTextNeeded イベント
DataGridView.RowErrorTextChanged イベント
ErrorProvider
その他の技術情報
Windows フォーム DataGridView コントロールを拡張するための推奨される手順


このページでは「.NET Framework クラス ライブラリ リファレンス」からDataGridViewRow.ErrorText プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDataGridViewRow.ErrorText プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDataGridViewRow.ErrorText プロパティ を検索

英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DataGridViewRow.ErrorText プロパティ」の関連用語

DataGridViewRow.ErrorText プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewRow.ErrorText プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS