Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Recursive access of controls of a root control
- // Source: https://social.msdn.microsoft.com/Forums/vstudio/en-US/04d08bfb-2214-4636-b12d-b98f33caa4c4/recursive-search-of-all-controls-on-a-form
- private void ProcessAllControls(Control rootControl, Action<Control> action)
- {
- foreach (Control childControl in rootControl.Controls)
- {
- ProcessAllControls(childControl, action);
- action(childControl);
- }
- }
- // Use as: ProcessAllControls(this, ctrl => ctrl.Visible = false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement