Following code shows some of the information available in BeforeCellUpdate event. It prints out the new value of the cell about to be updated for OrderDate column.
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.
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics
Private Sub UltraGrid1_BeforeCellUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs) Handles ultraGrid1.BeforeCellUpdate
' When the user modifies the value in a cell and exits the edit mode on that cell,
' the UltraGrid fires this event and if it's not canceled, updates the bound
' data source with the new value. If it's cancelled, then the grid doesn't update
' the cell and contents of the cell will revert back to the original value.
If e.Cell.Column.Key = "OrderDate" Then
If e.NewValue Is DBNull.Value Then
Debug.WriteLine("Cell is being updated with DBNull")
Else
Debug.WriteLine("Cell is being updated with " & e.NewValue.ToString())
End If
End If
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
private void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
{
// When the user modifies the value in a cell and exits the edit mode on that cell,
// the UltraGrid fires this event and if it's not canceled, updates the bound
// data source with the new value. If it's cancelled, then the grid doesn't update
// the cell and contents of the cell will revert back to the original value.
if ( e.Cell.Column.Key == "OrderDate" )
{
if ( e.NewValue == DBNull.Value )
Debug.WriteLine( "Cell is being updated with DBNull" );
else
Debug.WriteLine( "Cell is being updated with " + e.NewValue.ToString( ) );
}
}
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