GrapeCity MultiRow Windows Forms Documentation
Calculation Property
Example 


Gets or sets which calculation is handled by the SummaryCell.
Syntax
<SRDescriptionAttribute("Indicates how to calculate the SummaryCell's value.")>
<TypeConverterAttribute("GrapeCity.Win.MultiRow.CalculationTypeConverter, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<MergablePropertyAttribute(False)>
<DefaultValueAttribute()>
<RefreshPropertiesAttribute(RefreshProperties.All)>
<SRCategoryAttribute("Data")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.CalculationEditor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
Public Property Calculation As ICalculation
Dim instance As SummaryCell
Dim value As ICalculation
 
instance.Calculation = value
 
value = instance.Calculation
[SRDescription("Indicates how to calculate the SummaryCell's value.")]
[TypeConverter("GrapeCity.Win.MultiRow.CalculationTypeConverter, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[MergableProperty(false)]
[DefaultValue()]
[RefreshProperties(RefreshProperties.All)]
[SRCategory("Data")]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.CalculationEditor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
public ICalculation Calculation {get; set;}

Property Value

A ICalculation value that represents which calculation is done. The default is a null reference (Nothing in Visual Basic).
Remarks
You can specify a predefined Expression or MathStatistics with this property to make a calculation. You can also customize a calculation by implementing the ICalculation interface. After that, the calculation result is displayed in this cell.
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

SummaryCell Class
SummaryCell Members
Expression Class
MathStatistics Class

 

 


Copyright © GrapeCity, inc. All rights reserved.