Version

DeleteSelectedRows() Method

Deletes all rows that are selected.
Syntax
'Declaration
 
Public Overloads Sub DeleteSelectedRows() 
public void DeleteSelectedRows()
Remarks

Invoke this method to delete all selected rows. A particular row, regardless of whether it is selected, can be deleted by invoking its Delete method.

When one or more selected rows are deleted, the BeforeRowsDeleted event is generated, which provides an opportunity to prevent a specific row from being deleted.

When a row is deleted, it 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.

Selected UltraGridRow objects are contained in a SelectedRows collection, which can be accessed via the Rows property of the Selected property of the control.

Example
Following code shows you how to delete selected rows by calling DeleteSelectedRows method.

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

  Private Sub Button36_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button36.Click

      ' Check if there are any selected rows.
      If Me.UltraGrid1.Selected.Rows.Count > 0 Then
          ' Delete the selected rows by calling DeleteSelectedRows.
          Me.UltraGrid1.DeleteSelectedRows()
      Else
          ' Show a message if there are no selected rows.
          MessageBox.Show("There are no rows selected. Select rows first.")
      End If

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

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

	// Check if there are any selected rows.
	if ( this.ultraGrid1.Selected.Rows.Count > 0 )
	{
		// Delete the selected rows by calling DeleteSelectedRows.
		this.ultraGrid1.DeleteSelectedRows( );
	}
	else
	{
		// Show a message if there are no selected rows.
		MessageBox.Show( "There are no rows selected. Select rows first." );
	}

}
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