Version

Delete(Boolean) Method

Deletes the row.
Syntax
'Declaration
 
Public Overloads Function Delete( _
   ByVal displayPrompt As Boolean _
) As Boolean
public bool Delete( 
   bool displayPrompt
)

Parameters

displayPrompt
Specifies whether to display the delete confirmation prompt.
Remarks

When a row is deleted, the BeforeRowsDeleted event is generated. Afterwards, the row is removed from the control and its corresponding record is deleted from the data source. If the record cannot be removed from the data source, the Error event is generated.

The DeleteSelectedRows method of the control can be invoked to delete all selected rows.

Example
Following code shows you how to delete a row programmatically by calling Delete on the UltraGridRow object.

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

  Private Sub Button69_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button69.Click

      ' Get the row to delete. In this case we will use the active row.
      Dim row As UltraGridRow = Me.UltraGrid1.ActiveRow

      If Not row Is Nothing Then
          ' Delete the row by calling Delete method. Enclose the call in a try-catch
          ' block so if there is an error, we can catch it and show an error message box
          ' to the user.
          Try
              row.Delete()

              ' IsDeleted should be true after a row has been deleted.
              Debug.WriteLine("Row.IsDeleted = " & row.IsDeleted)
          Catch exc As Exception
              MessageBox.Show("Error occured during deleting the row.\n" & exc.Message, _
                              "Error deleting row", MessageBoxButtons.OK, MessageBoxIcon.Error)
          End Try
      Else
          ' If there is no active row, then prompt the user to select one.
          MessageBox.Show("Please select a single row to delete.")
      End If

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

private void button69_Click(object sender, System.EventArgs e)
{

	// Get the row to delete. In this case we will use the active row.
	UltraGridRow row = this.ultraGrid1.ActiveRow;

	if ( null != row )
	{
		// Delete the row by calling Delete method. Enclose the call in a try-catch
		// block so if there is an error, we can catch it and show an error message box
		// to the user.
		try
		{
			row.Delete( );

			// IsDeleted should be true after a row has been deleted.
			Debug.WriteLine( "Row.IsDeleted = " + row.IsDeleted );
		}
		catch ( Exception exc )
		{
			MessageBox.Show( "Error occured during deleting the row.\n" + exc.Message, 
					"Error deleting row", MessageBoxButtons.OK, MessageBoxIcon.Error );
		}
	}
	else
	{
		// If there is no active row, then prompt the user to select one.
		MessageBox.Show( "Please select a single row to delete." );
	}

}
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