Enable or Disable a Frame and its Contained Controls

Category:
Forms and Controls
Type:
Snippets
Difficulty:
Beginning

Author: Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
Im a bit of a VB newbie and needed a sub to automatically enable or disable all controls in a frame. I found a simple example on the web which worked well, but it did not take into account control arrays. So I experimented with it a bit and finally got it working so that any control, be it simple or part of a control array, would be enabled/disabled if it belongs to the specified frame. It is commented as best as I could given my limited knowledge of VB. The code is supplied "as is", no warranty of any kind is implied or given. Feel free to modify and/or distribute this code to your hearts content. It is my small contribution to the world of VB newbies :-)

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

Declarations:

Code: