Cancels the update of the row or cell when data has been changed (similar to pressing ESC).
Calling CancelUpdate on a row reverts its cells back to their original values since the row was last updated. More precisely, it calls CancelEdit on the underlying row object. See IEditableObject.CancelEdit for more information. Following code contains a button click handler which cancels update on the active row. Also notice that we are setting the UpdateMode to OnRowChange in the Form's Load event. This is so that this example can be demonstrated through a button click. If the UpdateMode were left to its default value, then as soon as the button was clicked on, the UltraGrid would loose focus and it would update the active row defeating the purpose of calling CancelUpdate on it.
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ultraGrid1.SetDataBinding(Me.DataSet11, "Customers")
' Change the value of UpdateMode from the default of OnRowChangeOrLostFocus to OnRowChange
' othewise the UltraGrid will update the row as soon as the button is clicked (since the
' UltraGrid would loose focus).
Me.ultraGrid1.UpdateMode = UpdateMode.OnRowChange
End Sub
Private Sub Button138_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button138.Click
' Get the active row.
Dim activeRow As UltraGridRow = Me.UltraGrid1.ActiveRow
' If the row has been modified, then revert back to the the original values
' since the row was last updated.
If Not activeRow Is Nothing AndAlso activeRow.DataChanged Then
activeRow.CancelUpdate()
End If
End Sub
'Declaration
Public Sub CancelUpdate()
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
private void Form1_Load(object sender, System.EventArgs e)
{
this.ultraGrid1.SetDataBinding( this.dataSet11, "Customers" );
// Change the value of UpdateMode from the default of OnRowChangeOrLostFocus to OnRowChange
// othewise the UltraGrid will update the row as soon as the button is clicked (since the
// UltraGrid would loose focus).
this.ultraGrid1.UpdateMode = UpdateMode.OnRowChange;
}
private void button138_Click(object sender, System.EventArgs e)
{
// Get the active row.
UltraGridRow activeRow = this.ultraGrid1.ActiveRow;
// If the row has been modified, then revert back to the the original values
// since the row was last updated.
if ( null != activeRow && activeRow.DataChanged )
{
activeRow.CancelUpdate( );
}
}
'Declaration
Public Sub CancelUpdate()
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