lvwMain.ListItems(i).Group = cG
         Next i
      End If
      
   Else
      ' Hide all the groups:
      lvwMain.ItemGroups.Enabled = False
      
   End If
   lvwMain.Visible = True
   
End Sub

Private Sub chkHeaderButtons_Click()
   lvwMain.HeaderButtons = (chkHeaderButtons.Value = Checked)
End Sub

Private Sub chkHeaderDragDrop_Click()
   lvwMain.HeaderDragDrop = (chkHeaderDragDrop.Value = Checked)
End Sub

Private Sub chkHideSelection_Click()
   lvwMain.HideSelection = (chkHideSelection.Value = C