My form has hundreds of controls: menus, panels, splitters, labels, text boxes, you name it.
Is there a way to disable every control except for a single button?
For a better, more elegant solution, which would be easy to maintain - you probably need to reconsider your design, such as put your button aside from other controls. Then assuming other controls are in a panel or a groupbox, just do Panel.Enabled = False
.
If you really want to keep your current design, you can Linearise ControlCollection tree into array of Control to avoid recursion and then do the following:
Array.ForEach(Me.Controls.GetAllControlsOfType(Of Control), Sub(x As Control) x.Enabled = False)
yourButton.Enabled = True