Version

FormulaReferenceError Event

Fired when calculating the formula involves referencing an object that could not be found.
Syntax
'Declaration
 
Public Event FormulaReferenceError As FormulaCalculationErrorEventHandler
public event FormulaCalculationErrorEventHandler FormulaReferenceError
Event Data

The event handler receives an argument of type Infragistics.Win.CalcEngine.FormulaCalculationErrorEventArgs containing data related to this event. The following FormulaCalculationErrorEventArgs properties provide information specific to this event.

PropertyDescription
Context (Inherited from Infragistics.Win.CalcEngine.FormulaErrorEventArgsBase) 
ErrorDisplayIcon  
ErrorDisplayText (Inherited from Infragistics.Win.CalcEngine.FormulaErrorEventArgsBase) 
ErrorInfo  
ErrorValue  
Remarks

This event fires whenever the UltraCalcManager attemps to calculate a formula which refers to a reference that cannot be found in the calculation network.

Example
Following code demonstrates how the FormulaReferenceError event works and some of the information available on the associated event args.

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 Infragistics.Win.CalcEngine
Imports Infragistics.Win.UltraWinCalcManager


   Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        Me.UltraCalcManager1.NamedReferences.Clear()
        ' Here the formula references N2 which does not exist. This will cause the
        ' FormulaReferenceError to be raised.
        Me.ultraCalcManager1.NamedReferences.Add("N1", "2 * [N2]")
    End Sub

    Private Sub UltraCalcManager1_FormulaReferenceError(ByVal sender As Object, ByVal e As Infragistics.Win.CalcEngine.FormulaCalculationErrorEventArgs) Handles ultraCalcManager1.FormulaReferenceError
        ' Context is the object associated with the formula that has the circularity.
        ' It could an instance of NamedReference, CalcSettings or a grid object like
        ' UltraGridColumn or SummarySettings.
        If TypeOf e.Context Is NamedReference Then
            Dim nr As NamedReference = DirectCast(e.Context, NamedReference)
            MessageBox.Show(Me, nr.Formula & " formula has a reference error.")
        End If

        ' If the formula with the reference error was on a control on the form then
        ' this error icon will be displayed with the control. Note that this does not
        ' apply to UltraGrid column and summary formulas.
        'e.ErrorDisplayIcon = new Icon( "erroricon.ico" );

        ' You can set the text of the tool tip that will displayed when the user hovers
        ' the mouse over the error icon beside the control associated with the formula.
        e.ErrorDisplayText = "Formula refers to something non existant."
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
using Infragistics.Win.CalcEngine;
using Infragistics.Win.UltraWinCalcManager;


		private void button1_Click(object sender, System.EventArgs e)
		{
			this.ultraCalcManager1.NamedReferences.Clear( );
			// Here the formula references N2 which does not exist. This will cause the
			// FormulaReferenceError to be raised.
			this.ultraCalcManager1.NamedReferences.Add( "N1", "2 * [N2]" );
		}

		private void ultraCalcManager1_FormulaReferenceError(object sender, Infragistics.Win.CalcEngine.FormulaCalculationErrorEventArgs e)
		{
			// Context is the object associated with the formula that has the circularity.
			// It could an instance of NamedReference, CalcSettings or a grid object like
			// UltraGridColumn or SummarySettings.
			if ( e.Context is NamedReference )
			{
				NamedReference nr = (NamedReference)e.Context;
				MessageBox.Show( this, nr.Formula + " formula has a reference error." );
			}

			// If the formula with the reference error was on a control on the form then
			// this error icon will be displayed with the control. Note that this does not
			// apply to UltraGrid column and summary formulas.
			//e.ErrorDisplayIcon = new Icon( "erroricon.ico" );
			
			// You can set the text of the tool tip that will displayed when the user hovers
			// the mouse over the error icon beside the control associated with the formula.
			e.ErrorDisplayText = "Formula refers to something non existant.";
		}
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