DataGridView.UserDeletingRow イベントとは? わかりやすく解説

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

DataGridView.UserDeletingRow イベント

メモ : このイベントは、.NET Framework version 2.0新しく追加されたものです。

ユーザーが DataGridView コントロールから行削除するときに発生します

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

Public Event UserDeletingRow As
 DataGridViewRowCancelEventHandler
Dim instance As DataGridView
Dim handler As DataGridViewRowCancelEventHandler

AddHandler instance.UserDeletingRow, handler
public event DataGridViewRowCancelEventHandler UserDeletingRow
public:
event DataGridViewRowCancelEventHandler^ UserDeletingRow {
    void add (DataGridViewRowCancelEventHandler^ value);
    void remove (DataGridViewRowCancelEventHandler^ value);
}
/** @event */
public void add_UserDeletingRow (DataGridViewRowCancelEventHandler
 value)

/** @event */
public void remove_UserDeletingRow (DataGridViewRowCancelEventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

UserDeletingRow イベント使用して開始残高行が選択含まれる場合DataGridView からの行の削除キャンセルするコード例次に示します

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;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

「DataGridView.UserDeletingRow イベント」の関連用語

DataGridView.UserDeletingRow イベントのお隣キーワード
検索ランキング

   

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



DataGridView.UserDeletingRow イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS