BeforeRowsDeletedEventHandler Delegate

delegate for handling event that is fired before rows are deleted
Public Delegate Sub BeforeRowsDeletedEventHandler( _
   ByVal sender As Object, _
   ByVal e As BeforeRowsDeletedEventArgs _
public delegate void BeforeRowsDeletedEventHandler( 
   object sender,
   BeforeRowsDeletedEventArgs e


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, _

      ' 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 =
		"Deleting " + e.Rows.Length.ToString( ) + " row(s). Continue ?",
		"Delete rows?", 
		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;


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