Version

NamedReferencesCollection Class

A collection of NamedReference objects in the calculation network.
Syntax
'Declaration
 
Public Class NamedReferencesCollection 
   Inherits Infragistics.Shared.KeyedSubObjectsCollectionBase
public class NamedReferencesCollection : Infragistics.Shared.KeyedSubObjectsCollectionBase 
Remarks

Add NamedReference objects to the collection for use as constants or calculated values that have no associated control.

Example
Following code demonstrates how named references can be used.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

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 named references named N1 and N2. N2 multiplies the value of
        ' N1 by 2.
        Me.UltraCalcManager1.NamedReferences.Add("N1", "5")
        Me.ultraCalcManager1.NamedReferences.Add("N2", "2 * [N1]")
    End Sub


    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' Change the value of N1 from 5 to 20. This will cause the N2 to get 
        ' recalculated and NamedReferenceResultChanged will be raised.
        Me.UltraCalcManager1.NamedReferences("N1").Formula = "20"
    End Sub

    Private Sub UltraCalcManager1_NamedReferenceResultChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinCalcManager.NamedReferenceResultChangedEventArgs) Handles ultraCalcManager1.NamedReferenceResultChanged
        System.Diagnostics.Debug.WriteLine(e.NamedReference.Key _
            & " named reference got calculated. It's TypeOf value is " _
            & e.NamedReference.FormulaResult.ToDouble())
    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 named references named N1 and N2. N2 multiplies the value of
			// N1 by 2.
			this.ultraCalcManager1.NamedReferences.Add( "N1", "5" );
			this.ultraCalcManager1.NamedReferences.Add( "N2", "2 * [N1]" );
		}

		
		private void button2_Click(object sender, System.EventArgs e)
		{
			// Change the value of N1 from 5 to 20. This will cause the N2 to get 
			// recalculated and NamedReferenceResultChanged will be raised.
			this.ultraCalcManager1.NamedReferences["N1"].Formula = "20";
		}

		private void ultraCalcManager1_NamedReferenceResultChanged(object sender, Infragistics.Win.UltraWinCalcManager.NamedReferenceResultChangedEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine( e.NamedReference.Key 
				+ " named reference got calculated. It's value is " 
				+ e.NamedReference.FormulaResult.ToDouble() );
		}
Requirements

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

See Also