Infragistics(R) NetAdvantage(R) Windows Forms
BeforeCellUpdateEventArgs Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : BeforeCellUpdateEventArgs Class

Event parameters used for the BeforeCellUpdate event

Syntax

Visual Basic (Declaration) 
Public Class BeforeCellUpdateEventArgs 
   Inherits System.ComponentModel.CancelEventArgs
C# 
public class BeforeCellUpdateEventArgs : System.ComponentModel.CancelEventArgs 

Example

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.

Visual BasicCopy Code
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
C#Copy Code
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( ) );
	}

}

See Also