Skip to content

Instantly share code, notes, and snippets.

@tjone270
Created September 22, 2019 22:44
Show Gist options
  • Save tjone270/8f3460435bd33f97c9192e55993b423c to your computer and use it in GitHub Desktop.
Save tjone270/8f3460435bd33f97c9192e55993b423c to your computer and use it in GitHub Desktop.

Revisions

  1. tjone270 created this gist Sep 22, 2019.
    10 changes: 10 additions & 0 deletions function.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    private IEnumerable<Control> GetAllControls(Control.ControlCollection controls) {
    List<Control> all_controls = new List<Control>();
    foreach (Control control in controls) {
    if (control.GetType() == typeof(GroupBox)) {
    all_controls.AddRange(GetAllControls(control.Controls));
    }
    all_controls.Add(control);
    }
    return all_controls;
    }