DataGridViewRowCancelEventArgs DataGridViewRowCancelEventArgs DataGridViewRowCancelEventArgs DataGridViewRowCancelEventArgs Class

定義

UserDeletingRowDataGridView イベントのデータを提供します。Provides data for the UserDeletingRow event of a DataGridView.

public ref class DataGridViewRowCancelEventArgs : System::ComponentModel::CancelEventArgs
public class DataGridViewRowCancelEventArgs : System.ComponentModel.CancelEventArgs
type DataGridViewRowCancelEventArgs = class
    inherit CancelEventArgs
Public Class DataGridViewRowCancelEventArgs
Inherits CancelEventArgs
継承
DataGridViewRowCancelEventArgsDataGridViewRowCancelEventArgsDataGridViewRowCancelEventArgsDataGridViewRowCancelEventArgs

この型の使用方法を次のコード例に示します。The following code example illustrates the use of this type. この例は、次の方法で使用できる大きな例の一部です。Windows フォーム DataGridView コントロールで仮想モードを実装します。This example is part of a larger example available in How to: Implement Virtual Mode in the Windows Forms DataGridView Control.

void dataGridView1_UserDeletingRow( Object^ /*sender*/,
    System::Windows::Forms::DataGridViewRowCancelEventArgs^ e )
{
   if ( e->Row->Index < this->customers->Count )
   {
      
      // If the user has deleted an existing row, remove the 
      // corresponding Customer object from the data store.
      this->customers->RemoveAt( e->Row->Index );
   }

   if ( e->Row->Index == this->rowInEdit )
   {
      
      // If the user has deleted a newly created row, release
      // the corresponding Customer object. 
      this->rowInEdit = -1;
      this->customerInEdit = nullptr;
   }
}
private void dataGridView1_UserDeletingRow(object sender,
    System.Windows.Forms.DataGridViewRowCancelEventArgs e)
{
    if (e.Row.Index < this.customers.Count)
    {
        // If the user has deleted an existing row, remove the 
        // corresponding Customer object from the data store.
        this.customers.RemoveAt(e.Row.Index);
    }

    if (e.Row.Index == this.rowInEdit)
    {
        // If the user has deleted a newly created row, release
        // the corresponding Customer object. 
        this.rowInEdit = -1;
        this.customerInEdit = null;
    }
}
Private Sub dataGridView1_UserDeletingRow(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) _
    Handles dataGridView1.UserDeletingRow

    If e.Row.Index < Me.customers.Count Then

        ' If the user has deleted an existing row, remove the 
        ' corresponding Customer object from the data store.
        Me.customers.RemoveAt(e.Row.Index)

    End If

    If e.Row.Index = Me.rowInEdit Then

        ' If the user has deleted a newly created row, release
        ' the corresponding Customer object. 
        Me.rowInEdit = -1
        Me.customerInEdit = Nothing

    End If

End Sub

注釈

UserDeletingRowイベントハンドラー内の行の削除を取り消すには、 Cancelプロパティをにtrue設定します。To cancel the deletion of a row in a UserDeletingRow event handler, set the Cancel property to true.

イベントを処理する方法の詳細については、次を参照してください。処理とイベントの発生します。For more information about how to handle events, see Handling and Raising Events.

コンストラクター

DataGridViewRowCancelEventArgs(DataGridViewRow) DataGridViewRowCancelEventArgs(DataGridViewRow) DataGridViewRowCancelEventArgs(DataGridViewRow) DataGridViewRowCancelEventArgs(DataGridViewRow)

DataGridViewRowCancelEventArgs クラスの新しいインスタンスを初期化します。Initializes a new instance of the DataGridViewRowCancelEventArgs class.

プロパティ

Cancel Cancel Cancel Cancel

イベントをキャンセルするかどうかを示す値を取得または設定します。Gets or sets a value indicating whether the event should be canceled.

(Inherited from CancelEventArgs)
Row Row Row Row

ユーザーが削除しようとしている行を取得します。Gets the row that the user is deleting.

メソッド

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象

こちらもご覧ください