The requested page is not available for the requested platform. You are viewing the content for Default platform.

XRSummary.GetResult() Method

Returns the calculated function's result.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public object GetResult()
Public Function GetResult As Object

Returns

Type Description
Object

An object representing the result for the calculated function.

Remarks

The calculated function is set by the XRSummary.Func property.

Examples

This example demonstrates how to use the XRSummary.GetResult method. It introduces a handler method for the XRControl.BeforePrint event which calculates the grand total for the labels, which display values for the first five months of the year.

Note

For this example to work correctly, its application should contain an XtraReport1 object, which contains five labels (totalJanuary, totalFebruary, totalMarch, totalApril, and totalMay) that calculate a summary for the corresponding months' values, and are situated on the ReportFooter or the GroupFooter band. Also the report should contain a grandTotal label situated on the same band as other labels.

using System;
using System.Drawing.Printing;
using DevExpress.XtraReports.UI;
// ...

private void grandTotal_BeforePrint(object sender, PrintEventArgs e) {
   // Create an array of labels which the total summary will be calculated for.
   XRLabel[] monthLabels = new XRLabel[] {totalJanuary, 
       totalFebruary, totalMarch, totalApril, totalMay};

   // Create a total variable.
   double total = 0;

   // Use the Summary.GetResult method of each summary label to calculate
   // the total of all the subtotals for the first 5 months in the year.
   foreach(XRLabel monthLabel in monthLabels){
      total += Convert.ToDouble(monthLabel.Summary.GetResult());
   }

   // Set the result to the grandTotal label's text.
   ((XRLabel)sender).Text = total.ToString("n2");
}
See Also