バージョン

Add(String) メソッド

指定した式で集計を追加します。このオーバー読み込みは、集計フッターの左の領域に集計を表示します。
シンタックス
'宣言
 
Public Overloads Function Add( _
   ByVal formula As String _
) As SummarySettings
public SummarySettings Add( 
   string formula
)

パラメータ

formula
集計によって評価され、結果が表示される式。

戻り値の型

新しい SummarySettings オブジェクトを作成し、それを提供される引数と共にコレクションに追加します。
解説

式集計が機能するためには、UltraGridBase.CalcManager プロパティに UltraCalcManager の有効なインスタンスを割り当てる必要があります。そのためには、デザインタイムにグリッドを含むフォームに UltraCalcManager のインスタンスを追加するか、またはランタイムに UltraGridBase.CalcManager プロパティを設定します。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid


    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraGrid1.InitializeLayout
        ' A valid UltraCalcManager instance must be assigned to the the CalcManager
        ' property of the UltraGrid in order to be able to use formulas. Typically
        ' you do this by simply putting an UltraCalcManager component on the form. If
        ' you have already put an UltraCalcManager on the form then you don't need to
        ' assign the CalcManager proeprty. NOTE: You must add UltraWinCalcManager
        ' assembly to the list of assembly references.
        Dim calcManager As Infragistics.Win.UltraWinCalcManager.UltraCalcManager
        calcManager = New Infragistics.Win.UltraWinCalcManager.UltraCalcManager(Me.Container)
        e.Layout.Grid.CalcManager = calcManager

        ' You can set formula on a column.
        e.Layout.Bands(0).Columns("Col1").Formula = "10 * [Col2]"

        ' You can create a formula summary. Following summary calculates the sum of
        ' Col1 column.
        e.Layout.Bands(0).Summaries.Add("Summary1", "sum( [Col1] )")

        ' FormulaErrorAppearance specifies the appearance of cells and summaries that
        ' contain formula errors.
        e.Layout.Override.FormulaErrorAppearance.BackColor = Color.Red

        ' FormulaRowIndexSource specifies which rows to use for calculations, all
        ' rows or just the visible rows. For example, if you have a summary "sum(
        ' [Column1] )" which sums up the values of Column1, VisibleIndex specifies
        ' that the values from only the visible rows should be used for calculating
        ' the sum.
        e.Layout.Override.FormulaRowIndexSource = FormulaRowIndexSource.ListIndex
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// A valid UltraCalcManager instance must be assigned to the the CalcManager
			// property of the UltraGrid in order to be able to use formulas. Typically
			// you do this by simply putting an UltraCalcManager component on the form. If
			// you have already put an UltraCalcManager on the form then you don't need to
			// assign the CalcManager proeprty. NOTE: You must add UltraWinCalcManager
			// assembly to the list of assembly references.
			Infragistics.Win.UltraWinCalcManager.UltraCalcManager calcManager;
			calcManager = new Infragistics.Win.UltraWinCalcManager.UltraCalcManager( this.Container );
			e.Layout.Grid.CalcManager = calcManager;

			// You can set formula on a column.
			e.Layout.Bands[0].Columns["Col1"].Formula = "10 * [Col2]";

			// You can create a formula summary. Following summary calculates the sum of
			// Col1 column.
			e.Layout.Bands[0].Summaries.Add( "Summary1", "sum( [Col1] )" );

			// FormulaErrorAppearance specifies the appearance of cells and summaries that
			// contain formula errors.
			e.Layout.Override.FormulaErrorAppearance.BackColor = Color.Red;			

			// FormulaRowIndexSource specifies which rows to use for calculations, all
			// rows or just the visible rows. For example, if you have a summary "sum(
			// [Column1] )" which sums up the values of Column1, VisibleIndex specifies
			// that the values from only the visible rows should be used for calculating
			// the sum.
			e.Layout.Override.FormulaRowIndexSource = FormulaRowIndexSource.ListIndex;
		}
参照