How to group a column programmatically in WinForms GridGroupingControl

15 Jun 20211 minute to read

To group a column programmatically, use the following code.

  • C#
  • //Shows the GroupDropArea.
    this.gridGroupingControl1.ShowGroupDropArea = true;
    
    //Groups by "Col1".
    this.gridGroupingControl1.TableDescriptor.GroupedColumns.Add("Col1", ListSortDirection.Ascending);
  • VB.NET
  • 'Shows the GroupDropArea.
    Me.gridGroupingControl1.ShowGroupDropArea = True
    
    'Groups by "Col1".
    Me.gridGroupingControl1.TableDescriptor.GroupedColumns.Add("Col1", ListSortDirection.Ascending)