Infragistics(R) NetAdvantage(R) Windows Forms
BeforeRowsDeletedEventArgs Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : BeforeRowsDeletedEventArgs Class

Event parameters used for the BeforeRowsDeleted event

Syntax

Visual Basic (Declaration) 
Public Class BeforeRowsDeletedEventArgs 
   Inherits System.ComponentModel.CancelEventArgs
C# 
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.

Visual BasicCopy Code
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
C#Copy Code
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;

}

See Also