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