GrapeCity MultiRow Windows Forms Documentation
ExpressionString Property (Expression)
Example 


Gets or sets the expression string that is used for calculations.
Syntax
<DefaultValueAttribute()>
<SRDescriptionAttribute("Indicates the expression which indicates how to calculate the cell's value using another cell or number.")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.ExpressionEditor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<RefreshPropertiesAttribute(RefreshProperties.All)>
Public Property ExpressionString As String
Dim instance As Expression
Dim value As String
 
instance.ExpressionString = value
 
value = instance.ExpressionString
[DefaultValue()]
[SRDescription("Indicates the expression which indicates how to calculate the cell's value using another cell or number.")]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.ExpressionEditor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[RefreshProperties(RefreshProperties.All)]
public string ExpressionString {get; set;}

Property Value

A System.String value that represents the calculation strategy. The default is String.Empty.
Remarks
The expression string should be correct and use one of the four arithmetic operations. You can put an "=" sign at the head of this string expression to make the calculation ignore it.
Example
The following code example shows how to customize the summary cell's calculation logic. 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
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 Class
Expression Members

 

 


Copyright © GrapeCity, inc. All rights reserved.