Infragistics(R) NetAdvantage(R) Windows Forms
FormulaErrorValue Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridColumn Class : FormulaErrorValue Property

Specifies the value to assign to the data source if the column’s formula evaluates to an error. If the column doesn’t have Formula set, this property is ignored.

Syntax

Visual Basic (Declaration) 
Public Property FormulaErrorValue As Object
C# 
public object FormulaErrorValue {get; set;}

Example

Following code sets FormulaErrorValue on three different columns.

Visual BasicCopy Code
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
        ' FormulaErrorValue specifies which value to send to the data source in case
        ' the formula associated with the cell evaluated to an error. NOTE: This does
        ' not specify what to display when there is a formula error. For that you
        ' will have to either hook into the UltraCalcManager's FormulaError event or
        ' localize the string resources.
        e.Layout.Bands(0).Columns("Date").FormulaErrorValue = New DateTime(1, 1, 1)
        e.Layout.Bands(0).Columns("currency").FormulaErrorValue = CType(-1, Decimal)
        e.Layout.Bands(0).Columns("string").FormulaErrorValue = "#ERR"
    End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// FormulaErrorValue specifies which value to send to the data source in case
			// the formula associated with the cell evaluated to an error. NOTE: This does
			// not specify what to display when there is a formula error. For that you
			// will have to either hook into the UltraCalcManager's FormulaError event or
			// localize the string resources.
			e.Layout.Bands[0].Columns["Date"].FormulaErrorValue = new DateTime( 1, 1, 1 );
			e.Layout.Bands[0].Columns["currency"].FormulaErrorValue = -1m;
			e.Layout.Bands[0].Columns["string"].FormulaErrorValue = "#ERR";
		}

See Also