Enable or Disable All Controls on All Frames

Category:
Forms and Controls
Type:
Snippets
Difficulty:
Intermediate
Author:
Lance Peterson

Version Compatibility: Visual Basic 6

More information:
When you disable a frame, all of the controls on the frame are unaccessible, even though they appear enabled. This can be confusing.

This code reads through the control collection of the current form looking for frames. When it finds a frame, it checks to see if it is enabled or disabled, and then enables or disables all controls that are contained in that frame.

This code can be changed to work for picture boxes instead or or in addition to frames.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: