'宣言 Public Event FormulaSyntaxError As FormulaSyntaxErrorEventHandler
public event FormulaSyntaxErrorEventHandler FormulaSyntaxError
イベント ハンドラが、このイベントに関連するデータを含む、FormulaSyntaxErrorEventArgs 型の引数を受け取りました。次の FormulaSyntaxErrorEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
Context Infragistics.Win.CalcEngine.FormulaErrorEventArgsBaseから継承されます。 | |
DisplayErrorMessage | エラーメッセージをエンドユーザーに表示するかどうかを取得または設定します。 |
ErrorDisplayText Infragistics.Win.CalcEngine.FormulaErrorEventArgsBaseから継承されます。 |
このイベントは、UltraCalcManager が構文が無効な数式を計算しようと試みるたびに発生します。
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 ); } }