Access the group from DisplayElements in WinForms GridGroupingControl

15 Jun 20211 minute to read

This page explains how to access the group from DisplayElements in Windows Forms GridGroupingControl and more details.

How to access the group from DisplayElements in Windows Forms GridGroupingControl

To access the group from DisplayElements, use the following code snippet.

  • C#
  • //For all the display elements in the Table.
    foreach(Element el in gridGroupingControl1.Table.DisplayElements)
    {
    //DisplayElementKind.Record or DisplayElementKind.Summary.
    if(el.Kind==DisplayElementKind.Record || DisplayElementKind.Summary)
    {
    Group g = el.ParentGroup;
    System.Diagnostics.Trace.WriteLine(g.Info);
    }
    }
  • VB.NET
  • 'For all the display elements in the Table
    For Each el As Element In gridGroupingControl1.Table.DisplayElements
    'DisplayElementKind.Record or DisplayElementKind.Summary
        If el.Kind=DisplayElementKind.Record OrElse el.Kind=DisplayElementKind.Summary Then
        Dim g As Group = el.ParentGroup
             System.Diagnostics.Trace.WriteLine(g.Info)
         End If
    Next el