# VBForums CodeBank > CodeBank - C# >  Visit Every Control on a Form (includes nested controls, no recursion)

## jmcilhinney

VB version here.

This code will visit every control on a form, regardless of how deeply it's nested. You could have a TextBox in a Panel in a Splitter in a GroupBox in a TabPage in a TabControl in a Panel and it will still be found. No recursion is need on your part, as this will simply follow the tab order from start to finish. It also doesn't matter if a control has it's TabStop set to False, as it must still have a TabIndex.

```
Control ctl = this.GetNextControl(this, true); // Get the first control in the tab order.

while (ctl != null)
{
    // Use ctl here.

    ctl = this.GetNextControl(ctl, true); // Get the next control in the tab order.
}
```

No doubt the GetNextControl method uses recursion internally, but that's not our concern. This will keep your code nice and neat and you'd need a very, very large number of controls before you'd notice a difference in performance.

----------

