'宣言 Public Delegate Sub FormulaSyntaxErrorEventHandler( _ ByVal sender As Object, _ ByVal e As FormulaSyntaxErrorEventArgs _ )
public delegate void FormulaSyntaxErrorEventHandler( object sender, FormulaSyntaxErrorEventArgs e )
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 ); } }