DataGridViewCellValidatingEventArgs クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCellValidatingEventArgs クラスの意味・解説 

DataGridViewCellValidatingEventArgs クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

DataGridView コントロールの CellValidating イベントデータ提供します

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

Public Class DataGridViewCellValidatingEventArgs
    Inherits CancelEventArgs
Dim instance As DataGridViewCellValidatingEventArgs
public class DataGridViewCellValidatingEventArgs
 : CancelEventArgs
public ref class DataGridViewCellValidatingEventArgs
 : public CancelEventArgs
public class DataGridViewCellValidatingEventArgs
 extends CancelEventArgs
public class DataGridViewCellValidatingEventArgs
 extends CancelEventArgs
解説解説
使用例使用例

CellValidating イベント処理してユーザー正の整数だけを入力するようにするコード例次に示します。この例は VirtualMode のリファレンス トピック取り上げている例の一部分です。

Private Sub dataGridView1_CellValidating(ByVal
 sender As Object, _
    ByVal e _
    As DataGridViewCellValidatingEventArgs) _
    Handles dataGridView1.CellValidating

    Me.dataGridView1.Rows(e.RowIndex).ErrorText = ""
    Dim newInteger As Integer

    ' Don't try to validate the 'new row' until finished 
    ' editing since there
    ' is not any point in validating its initial value.
    If dataGridView1.Rows(e.RowIndex).IsNewRow Then
 Return
    If Not Integer.TryParse(e.FormattedValue.ToString(),
 newInteger) _
        OrElse newInteger < 0 Then

        e.Cancel = True
        Me.dataGridView1.Rows(e.RowIndex).ErrorText = "the
 value must be a non-negative integer"

    End If
End Sub
private void dataGridView1_CellValidating(object
 sender,
    DataGridViewCellValidatingEventArgs e)
{
    dataGridView1.Rows[e.RowIndex].ErrorText = "";
    int newInteger;

    // Don't try to validate the 'new row' until finished 
    // editing since there
    // is not any point in validating its initial value.
    if (dataGridView1.Rows[e.RowIndex].IsNewRow) { return;
 }
    if (!int.TryParse(e.FormattedValue.ToString()
,
        out newInteger) || newInteger < 0)
    {
        e.Cancel = true;
        dataGridView1.Rows[e.RowIndex].ErrorText = "the value must be a non-negative
 integer";
    }
}
void VirtualConnector::dataGridView1_CellValidating
    (Object^ sender, DataGridViewCellValidatingEventArgs^ e)
{
    int newInteger;

    // Don't try to validate the 'new row' until finished 
    // editing since there
    // is not any point in validating its initial value.
    if (dataGridView1->Rows[e->RowIndex]->IsNewRow) 
    {
        return; 
    }
    if (!Int32::TryParse(e->FormattedValue->ToString(),
 
        newInteger) || (newInteger < 0))
    {
        e->Cancel = true;
    }
}
private void dataGridView1_CellValidating(Object
 sender,
    DataGridViewCellValidatingEventArgs e)
{
    int newInteger = 0;
    // Don't try to validate the 'new row' until finished 
    // editing since there
    // is not any point in validating its initial value.
    if (dataGridView1.get_Rows().get_Item(
        e.get_RowIndex()).get_IsNewRow()) {
        return;
    }
    if (!(Int32.TryParse(e.get_FormattedValue().ToString(), newInteger))
 
        || newInteger < 0) {
        e.set_Cancel(true);
    }
} //dataGridView1_CellValidating
継承階層継承階層
System.Object
   System.EventArgs
     System.ComponentModel.CancelEventArgs
      System.Windows.Forms.DataGridViewCellValidatingEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCellValidatingEventArgs メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.CellValidating イベント
DataGridView.CellValidated イベント
DataGridView.CellValuePushed イベント
DataGridView.OnCellValidating
DataGridViewCell クラス
DataGridViewCellValidatingEventHandler
FormattedValue
RowIndex
ColumnIndex
CancelEventArgs.Cancel



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewCellValidatingEventArgs クラス」の関連用語

DataGridViewCellValidatingEventArgs クラスのお隣キーワード
検索ランキング

   

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



DataGridViewCellValidatingEventArgs クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS