Version

BeforeRowsDeletedEventArgs Class

Event parameters used for the BeforeRowsDeleted event
Syntax
'Declaration
 
Public Class BeforeRowsDeletedEventArgs 
   Inherits System.ComponentModel.CancelEventArgs
public class BeforeRowsDeletedEventArgs : System.ComponentModel.CancelEventArgs 
Example
The following sample code uses BeforeRowsDeleted event to display a custom message box to prompt the user before deleting rows.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub UltraGrid1_BeforeRowsDeleted(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowsDeletedEventArgs) Handles ultraGrid1.BeforeRowsDeleted

      ' Stop the grid from displaying it's message box.
      e.DisplayPromptMsg = False

      ' Display our own custom message box.
      Dim result As DialogResult = System.Windows.Forms.MessageBox.Show( _
              "Deleting " & e.Rows.Length.ToString() & " row(s). Continue ?", _
              "Delete rows?", _
              System.Windows.Forms.MessageBoxButtons.YesNo, _
              System.Windows.Forms.MessageBoxIcon.Question)

      ' If the user clicked No on the message box, cancel the deletion of rows.
      If System.Windows.Forms.DialogResult.No = result Then
          e.Cancel = True
      End If

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_BeforeRowsDeleted(object sender, Infragistics.Win.UltraWinGrid.BeforeRowsDeletedEventArgs e)
{

	// Stop the grid from displaying it's message box.
	e.DisplayPromptMsg = false;
	 
	// Display our own custom message box.
	System.Windows.Forms.DialogResult result =
		System.Windows.Forms.MessageBox.Show( 
		"Deleting " + e.Rows.Length.ToString( ) + " row(s). Continue ?",
		"Delete rows?", 
		System.Windows.Forms.MessageBoxButtons.YesNo, 
		System.Windows.Forms.MessageBoxIcon.Question );
	 
	// If the user clicked No on the message box, cancel the deletion of rows.
	if ( System.Windows.Forms.DialogResult.No == result )
		e.Cancel = true;

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also