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

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

DataGridViewCellFormattingEventArgs.RowIndex プロパティ

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

書式指定するセルの行インデックス取得します

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

Dim instance As DataGridViewCellFormattingEventArgs
Dim value As Integer

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

プロパティ
書式指定するセルの行インデックス

解説解説

RowIndex プロパティ使用すると、DataGridView の Rows プロパティにおけるインデックス取得できます

使用例使用例

次のコード例では、RowIndex プロパティ使用して書式指定するセル取得する方法示します。このセル参照は、次にセルツールヒントテキスト設定するために使用されます。

' Sets the ToolTip text for cells in the Rating column.
Sub dataGridView1_CellFormatting(ByVal sender
 As Object, _
    ByVal e As DataGridViewCellFormattingEventArgs)
 _
    Handles dataGridView1.CellFormatting

    If e.ColumnIndex = Me.dataGridView1.Columns("Rating").Index
 _
        AndAlso Not (e.Value Is
 Nothing) Then

        With Me.dataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex)

            If e.Value.Equals("*")
 Then
                .ToolTipText = "very bad"
            ElseIf e.Value.Equals("**")
 Then
                .ToolTipText = "bad"
            ElseIf e.Value.Equals("***")
 Then
                .ToolTipText = "good"
            ElseIf e.Value.Equals("****")
 Then
                .ToolTipText = "very good"
            End If

        End With

    End If

End Sub 'dataGridView1_CellFormatting
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(object sender, 
    DataGridViewCellFormattingEventArgs e)
{
    if ( (e.ColumnIndex == this.dataGridView1.Columns["Rating"].Index)
        && e.Value != null )
    {
        DataGridViewCell cell = 
            this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
        if (e.Value.Equals("*"))
        {                
            cell.ToolTipText = "very bad";
        }
        else if (e.Value.Equals("**"))
        {
            cell.ToolTipText = "bad";
        }
        else if (e.Value.Equals("***"))
        {
            cell.ToolTipText = "good";
        }
        else if (e.Value.Equals("****"))
        {
            cell.ToolTipText = "very good";
        }
    }
}
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(Object^ /*sender*/, 
    DataGridViewCellFormattingEventArgs^ e)
{
    if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index)
        && e->Value != nullptr )
    {
        DataGridViewCell^ cell = 
            this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex];
        if (e->Value->Equals("*"))
        {                
            cell->ToolTipText = "very bad";
        }
        else if (e->Value->Equals("**"))
        {
            cell->ToolTipText = "bad";
        }
        else if (e->Value->Equals("***"))
        {
            cell->ToolTipText = "good";
        }
        else if (e->Value->Equals("****"))
        {
            cell->ToolTipText = "very good";
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCellFormattingEventArgs クラス
DataGridViewCellFormattingEventArgs メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.Rows プロパティ
DataGridView.CellFormatting イベント



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS