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

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

DataGridView.SelectedRows プロパティ

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

ユーザー選択した行のコレクション取得します

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

Public ReadOnly Property
 SelectedRows As DataGridViewSelectedRowCollection
Dim instance As DataGridView
Dim value As DataGridViewSelectedRowCollection

value = instance.SelectedRows
public DataGridViewSelectedRowCollection SelectedRows { get;
 }
public:
property DataGridViewSelectedRowCollection^ SelectedRows {
    DataGridViewSelectedRowCollection^ get ();
}
/** @property */
public DataGridViewSelectedRowCollection get_SelectedRows ()
public function get SelectedRows
 () : DataGridViewSelectedRowCollection

プロパティ
ユーザー選択した行を格納している DataGridViewSelectedRowCollection。

解説解説
使用例使用例

SelectedRows プロパティを UserDeletingRow イベント使用する方法を、次のコード例示します。この例では、1 行目が SelectedRows コレクション格納されている場合削除キャンセルされます。

Private Sub UserDeletingRow(ByVal
 sender As Object, _
    ByVal e As DataGridViewRowCancelEventArgs)
 _
    Handles DataGridView1.UserDeletingRow

    Dim startingBalanceRow As DataGridViewRow
 = DataGridView1.Rows(0)

    ' Check if the starting balance row is included in the selected
 rows
    If e.Row.Equals(startingBalanceRow) Then

        ' Do not allow the user to delete the Starting Balance row.
        MessageBox.Show("Cannot delete Starting Balance row!")
    End If

    ' Cancel the deletion if the Starting Balance row is included.
    e.Cancel = True
End Sub
private void DataGridView1_UserDeletingRow(object
 sender,
    DataGridViewRowCancelEventArgs e)
{
    DataGridViewRow startingBalanceRow = DataGridView1.Rows[0];

    // Check if the Starting Balance row is included in the selected
 rows
    if (DataGridView1.SelectedRows.Contains(startingBalanceRow))
    {
        // Do not allow the user to delete the Starting Balance row.
        if (e.Row.Equals(startingBalanceRow))
        {
            MessageBox.Show("Cannot delete Starting Balance row!");
        }

        // Cancel the deletion if the Starting Balance row is included.
        e.Cancel = true;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS