'宣言 Public Event FormulaCircularityError As FormulaCircularityErrorEventHandler
public event FormulaCircularityErrorEventHandler FormulaCircularityError
イベント ハンドラが、このイベントに関連するデータを含む、FormulaCircularityErrorEventArgs 型の引数を受け取りました。次の FormulaCircularityErrorEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
Context Infragistics.Win.CalcEngine.FormulaErrorEventArgsBaseから継承されます。 | |
DisplayErrorMessage | エラーメッセージをエンドユーザーに表示するかどうかを取得または設定します。 |
ErrorDisplayText Infragistics.Win.CalcEngine.FormulaErrorEventArgsBaseから継承されます。 |
FormulaCircularityError は、計算式が直接または間接的に自己参照しようとすると発生します。
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() ' Add two formulas that refer to each other. This will cause the ' FormulaCircularityError event to be raised. This event will be raised only ' once even if there are multiple formulas that are involved in circularity. Me.ultraCalcManager1.NamedReferences.Add("N1", "2 * [N2]") Me.ultraCalcManager1.NamedReferences.Add("N2", "2 * [N1]") End Sub Private Sub UltraCalcManager1_FormulaCircularityError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinCalcManager.FormulaCircularityErrorEventArgs) Handles ultraCalcManager1.FormulaCircularityError ' You can prevent the default behavior of displaying the message box by ' setting the DisplayErrorMessage to false. e.DisplayErrorMessage = False ' You can use the ErrorDisplayText to set the text that will be displayed ' in the error message box. NOTE: We are disabling the message box by ' setting DisplayErrorMessage to false above so this won't have any effect. e.ErrorDisplayText = "Circularity Detected !" ' 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 is involved in a circularity.") 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( ); // Add two formulas that refer to each other. This will cause the // FormulaCircularityError event to be raised. This event will be raised only // once even if there are multiple formulas that are involved in circularity. this.ultraCalcManager1.NamedReferences.Add( "N1", "2 * [N2]" ); this.ultraCalcManager1.NamedReferences.Add( "N2", "2 * [N1]" ); } private void ultraCalcManager1_FormulaCircularityError(object sender, Infragistics.Win.UltraWinCalcManager.FormulaCircularityErrorEventArgs e) { // You can prevent the default behavior of displaying the message box by // setting the DisplayErrorMessage to false. e.DisplayErrorMessage = false; // You can use the ErrorDisplayText to set the text that will be displayed // in the error message box. NOTE: We are disabling the message box by // setting DisplayErrorMessage to false above so this won't have any effect. e.ErrorDisplayText = "Circularity Detected !"; // 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 is involved in a circularity." ); } }