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

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

DataGridViewBand.Index プロパティ

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

DataGridView コントロール内のバンド相対位置取得します

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

Dim instance As DataGridViewBand
Dim value As Integer

value = instance.Index
/** @property */
public int get_Index ()

プロパティ
格納されている DataGridViewRowCollection または DataGridViewColumnCollection 内のバンドの 0 から始まる位置既定値は -1 で、関連付けられた DataGridView コントロールがないことを示します

解説解説

このプロパティの値は、コレクション内にあるバンド現在の表示位置に、必ずしも対応してはいません。たとえば、ユーザー実行時DataGridView 内の列を並べ替え場合 (AllowUserToOrderColumns プロパティtrue設定されていることを前提とする)、各列の Index プロパティの値は変更されません。代わりに、列の DisplayIndex 値が変更されます。ただし、行を並べ替えると、Index 値が変更されます。

使用例使用例

Index プロパティ使用してラベル設定するコード例次に示しますバンドIndex プロパティアクセスするには、DataGridViewColumn を使用します

' Style and number columns.
Private Sub Button8_Click(ByVal
 sender As Object, _
    ByVal args As EventArgs) Handles
 Button8.Click

    Dim style As DataGridViewCellStyle = _
        New DataGridViewCellStyle()
    style.Alignment = _
        DataGridViewContentAlignment.MiddleCenter
    style.ForeColor = Color.IndianRed
    style.BackColor = Color.Ivory

    For Each column As DataGridViewColumn
 _
        In dataGridView.Columns

        column.HeaderCell.Value = _
            column.Index.ToString
        column.HeaderCell.Style = style
    Next
End Sub
// Style and number columns.
private void Button8_Click(object sender,
    EventArgs args)
{
    DataGridViewCellStyle style = new DataGridViewCellStyle();
    style.Alignment =
        DataGridViewContentAlignment.MiddleCenter;
    style.ForeColor = Color.IndianRed;
    style.BackColor = Color.Ivory;

    foreach (DataGridViewColumn column in dataGridView.Columns)
    {
        column.HeaderCell.Value = column.Index.ToString();
        column.HeaderCell.Style = style;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewBand クラス
DataGridViewBand メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewRowCollection
DataGridViewColumnCollection
DataGridView.AllowUserToOrderColumns プロパティ


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

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

辞書ショートカット

すべての辞書の索引

「DataGridViewBand.Index プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS