GrapeCity MultiRow Windows Forms Documentation
Expression Class
Members  Example 


Represents a special calculation capability, that treats an expression string as the calculation strategy and uses this strategy to calculate the corresponding result. This class cannot be inherited.
Syntax
Public NotInheritable Class Expression 
   Implements ICalculation 
Dim instance As Expression
public sealed class Expression : ICalculation  
Remarks

This class calculates a value based on a string expression. This ExpressionString only resolves the "+","-","*","/","(",")" operators.

The dependent cells formatted value types should be System.Decimal or should convert to System.Decimal.

Example
The following code example shows how to customize the summary cell's calculation logic using this class. This code example is part of a larger example provided for the SummaryCell class.
private SummaryCell CreateSubTotalSummaryCell()
        {
            // Calculates the subtotal based on 'Price' and 'Count' in the same row.
            SummaryCell summaryCell = new SummaryCell();
            summaryCell.Name = "SubTotal";
            summaryCell.Calculation = new Expression("Price * Count");
            summaryCell.Style.Format = "C";
            summaryCell.Style.BackColor = Color.Wheat;
            return summaryCell;
        }
Private Function CreateSubTotalSummaryCell() As SummaryCell
        ' Calculates the subtotal based on 'Price' and 'Count' in the same row.
        Dim summaryCell As New SummaryCell()
        summaryCell.Name = "SubTotal"
        summaryCell.Calculation = New Expression("Price * Count")
        summaryCell.Style.Format = "C"
        summaryCell.Style.BackColor = Color.Wheat
        Return summaryCell
    End Function
Inheritance Hierarchy

System.Object
   GrapeCity.Win.MultiRow.Expression

Requirements

Target Platforms: 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

Reference

Expression Members
GrapeCity.Win.MultiRow Namespace
SummaryCell Class
Calculation Property
MathStatistics Class
ICalculation Interface

 

 


Copyright © GrapeCity, inc. All rights reserved.