Category / Section
                                    
                                How to get the summary values of GridSummaryRow in WinForms GridGroupingControl?
                
                
                    1 min read
                
            
    Summaries
To get the
summary values of a summary row, GridEngine.GetSummaryText method
can be used.
C#
//Event Subscription
this.gridGroupingControl1.SourceListListChangedCompleted += GridGroupingControl1_SourceListListChangedCompleted;
//Event Customization
private void GridGroupingControl1_SourceListListChangedCompleted(object sender, TableListChangedEventArgs e)
{
    int row = this.gridGroupingControl1.TableModel.RowCount;
    var rec = this.gridGroupingControl1.Table.DisplayElements[row];
    GridSummaryRow sr = rec as GridSummaryRow;
    if (sr != null)
    {
        foreach (GridSummaryColumnDescriptor scd in sr.SummaryRowDescriptor.SummaryColumns)
        {
            string result = GridEngine.GetSummaryText(sr.ParentGroup, scd);
            this.textBox1.Text = result;
        }
    }
} VB
'Event Subscription
AddHandler Me.gridGroupingControl1.SourceListListChangedCompleted, AddressOf GridGroupingControl1_SourceListListChangedCompleted
'Event Customization
Private Sub GridGroupingControl1_SourceListListChangedCompleted(ByVal sender As Object, ByVal e As TableListChangedEventArgs)
    Dim row As Integer = Me.gridGroupingControl1.TableModel.RowCount
    Dim rec = Me.gridGroupingControl1.Table.DisplayElements(row)
    Dim sr As GridSummaryRow = TryCast(rec, GridSummaryRow)
    If sr IsNot Nothing Then
        For Each scd As GridSummaryColumnDescriptor In sr.SummaryRowDescriptor.SummaryColumns
            Dim result As String = GridEngine.GetSummaryText(sr.ParentGroup, scd)
            Me.textBox1.Text = result
        Next scd
    End If
End SubThe
Screenshot below illustrates the summary value in GridGroupingControl.

Samples:
Reference Link: Summaries
