DataGridViewRowCancelEventArgs Class
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 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.