Version

FormulaSyntaxErrorEventHandler Delegate

Delegate for Formula Syntax Error event of an UltraCalcManager.
Syntax
'Declaration
 
Public Delegate Sub FormulaSyntaxErrorEventHandler( _
   ByVal sender As Object, _
   ByVal e As FormulaSyntaxErrorEventArgs _
) 
public delegate void FormulaSyntaxErrorEventHandler( 
   object sender,
   FormulaSyntaxErrorEventArgs e
)

Parameters

sender
e
Example
Following code demonstrates how the FormulaSyntaxError 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()
        ' Deliberately add a formula that contains a syntax error.
        Me.ultraCalcManager1.NamedReferences.Add("N1", "2 ** 4")
    End Sub

    Private Sub UltraCalcManager1_FormulaSyntaxError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinCalcManager.FormulaSyntaxErrorEventArgs) Handles ultraCalcManager1.FormulaSyntaxError
        ' You can prevent the default behavior of displaying the message box by
        ' setting the DisplayErrorMessage to false.
        e.DisplayErrorMessage = False

        ' 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 syntax error. Here is the original error message:" & vbCrLf & e.ErrorDisplayText)
        End If
    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( );
			// Deliberately add a formula that contains a syntax error.
			this.ultraCalcManager1.NamedReferences.Add( "N1", "2 ** 4" );
		}

		private void ultraCalcManager1_FormulaSyntaxError(object sender, Infragistics.Win.UltraWinCalcManager.FormulaSyntaxErrorEventArgs e)
		{
			// You can prevent the default behavior of displaying the message box by
			// setting the DisplayErrorMessage to false.
			e.DisplayErrorMessage = false;

			// 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 syntax error. Here is the original error message:\r\n" + e.ErrorDisplayText );
			}
		}
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