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

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

DataGridViewCellParsingEventArgs.ColumnIndex プロパティ

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

解析を必要とするセル データの列インデックス取得します

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

Dim instance As DataGridViewCellParsingEventArgs
Dim value As Integer

value = instance.ColumnIndex
public int ColumnIndex { get;
 }
public:
property int ColumnIndex {
    int get ();
}
/** @property */
public int get_ColumnIndex ()

プロパティ
変更されセルの列インデックス

解説解説
使用例使用例

ColumnIndex使用して変更されセル日付列にあるかどうか検出する方法次のコード例示します

' Handling CellParsing allows one to accept user input, then map it
 to a different
' internal representation.
Private Sub dataGridView1_CellParsing(ByVal
 sender As Object, _
    ByVal e As DataGridViewCellParsingEventArgs)
 _
    Handles dataGridView1.CellParsing

    If Me.dataGridView1.Columns(e.ColumnIndex).Name
 = _
        "Release Date" Then
        If e IsNot Nothing Then
            If e.Value IsNot Nothing Then
                Try
                    ' Map what the user typed into UTC.
                    e.Value = _
                    DateTime.Parse(e.Value.ToString()).ToUniversalTime()
                    ' Set the ParsingApplied property to 
                    ' Show the event is handled.
                    e.ParsingApplied = True

                Catch ex As FormatException
                    ' Set to false in case another CellParsing handler
                    ' wants to try to parse this DataGridViewCellParsingEventArgs
 instance.
                    e.ParsingApplied = False
                End Try
            End If
        End If
    End If
End Sub
// Handling CellParsing allows one to accept user input, then map it
 to a different
// internal representation.
private void dataGridView1_CellParsing(object
 sender, DataGridViewCellParsingEventArgs e)
{
    if (this.dataGridView1.Columns[e.ColumnIndex].Name
 == "Release Date")
    {
        if (e != null)
        {
            if (e.Value != null)
            {
                try
                {
                    // Map what the user typed into UTC.
                    e.Value = DateTime.Parse(e.Value.ToString()).ToUniversalTime();
                    // Set the ParsingApplied property to 
                    // Show the event is handled.
                    e.ParsingApplied = true;

                }
                catch (FormatException)
                {
                    // Set to false in case another CellParsing handler
                    // wants to try to parse this DataGridViewCellParsingEventArgs
 instance.
                    e.ParsingApplied = false;
                }
            }
        }
    }
}
// Handling CellParsing allows one to accept user input, then map it
 to a different
// internal representation.
void dataGridView1_CellParsing( Object^ /*sender*/, DataGridViewCellParsingEventArgs^
 e )
{
   if ( this->dataGridView1->Columns[
 e->ColumnIndex ]->Name->Equals( "Release Date" ) )
   {
      if ( e != nullptr )
      {
         if ( e->Value != nullptr )
         {
            try
            {
               // Map what the user typed into UTC.
               e->Value = DateTime::Parse( e->Value->ToString() ).ToUniversalTime();

               // Set the ParsingApplied property to 
               // Show the event is handled.
               e->ParsingApplied = true;
            }
            catch ( FormatException^ /*ex*/ ) 
            {
               // Set to false in case another CellParsing handler
               // wants to try to parse this DataGridViewCellParsingEventArgs
 instance.
               e->ParsingApplied = false;
            }
         }
      }
   }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCellParsingEventArgs クラス
DataGridViewCellParsingEventArgs メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.Columns プロパティ
DataGridView.CellParsing イベント



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

辞書ショートカット

すべての辞書の索引

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

   

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



DataGridViewCellParsingEventArgs.ColumnIndex プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS