DataGridViewRowCancelEventArgs Class
Provides data for the UserDeletingRow event of a DataGridView.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
To cancel the deletion of a row in a UserDeletingRow event handler, set the Cancel property to true.
For more information about handling events, see Consuming Events.
The following code example illustrates the use of this type. This example is part of a larger example available in How to: Implement Virtual Mode in the Windows Forms DataGridView Control.
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
System.EventArgs
System.ComponentModel.CancelEventArgs
System.Windows.Forms.DataGridViewRowCancelEventArgs
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.