The ReCalc method forces the synchronous recalculation of all formulas in the calculation network.
When the CalcFrequency property is set to Manual, no calculations are performed unless this method or the Infragistics.Win.CalcEngine.IUltraCalcManager.EnsureCalculated(Infragistics.Win.CalcEngine.IUltraCalcReference,System.Boolean) method is called.
When the CalcFrequency property is set to Asynchronous, this method can be called to force all calculations to be completed synchronously, so that calculated values can be depended upon to be correct. It is generally more efficient to use the Infragistics.Win.CalcEngine.IUltraCalcManager.EnsureCalculated(Infragistics.Win.CalcEngine.IUltraCalcReference,System.Boolean) method in this case, since it ensures the calculation of a single reference as opposed to all references in the calculation network.
When the CalcFrequency property is set to Synchronous, this method is usually not neccessary, unless a control in the calculation network that is being used as the source of a calcatulion does not have a event for the property being used as its PropertyName In this case, it is generally more efficient to use Infragistics.Win.CalcEngine.IUltraCalcManager.EnsureCalculated(Infragistics.Win.CalcEngine.IUltraCalcReference,System.Boolean) instead of ReCalc.
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() Me.UltraCalcManager1.NamedReferences.Add("N1", "5") Me.ultraCalcManager1.NamedReferences.Add("N2", "2 * [N1]") Dim result As UltraCalcValue result = Me.UltraCalcManager1.NamedReferences("N2").FormulaResult System.Diagnostics.Debug.WriteLine("Result before calling Recalc: " & result.ToString()) Me.UltraCalcManager1.ReCalc(-1) result = Me.UltraCalcManager1.NamedReferences("N2").FormulaResult System.Diagnostics.Debug.WriteLine("Result after calling Recalc: " & result.ToString()) 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( ); this.ultraCalcManager1.NamedReferences.Add( "N1", "5" ); this.ultraCalcManager1.NamedReferences.Add( "N2", "2 * [N1]" ); UltraCalcValue result; result = this.ultraCalcManager1.NamedReferences["N2"].FormulaResult; System.Diagnostics.Debug.WriteLine( "Result before calling Recalc: " + result.ToString( ) ); this.ultraCalcManager1.ReCalc( -1 ); result = this.ultraCalcManager1.NamedReferences["N2"].FormulaResult; System.Diagnostics.Debug.WriteLine( "Result after calling Recalc: " + result.ToString( ) ); }
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