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." ); } }