Microsoft Office Tutorials and References
In Depth Information
figurE 19-13
When you place controls within a Frame control, manipulating the Frame’s properties can affect all
the controls inside the Frame. For example, assuming the Frame control shown in Figure 19-13 is
named Frame1, this line of code would hide that frame along with all the controls inside it:
Frame1.Visible= False
Sometimes you will want your Frame to be visible, but you want all the controls inside the Frame to
be temporarily disabled. You can disable the Frame and render its controls unusable with the
following line of code:
Frame1.Enabled = False
If you test that for yourself, you’ll see a curious result, which is the controls inside the Frame are not
“grayed out” but are essentially disabled, because they are rendered useless by virtue of the Frame
being disabled. The controls themselves appear to be enabled and that can fool your users into
wondering what’s wrong with perfectly good looking controls that do not respond to any keystrokes or
mouse clicks.
If you want to disable the actual controls inside the Frame, and make them look disabled, you must
loop through each of the controls inside the Frame with the following example code. Note that this
code will not disable Frame1, only the controls inside it.
Dim FrmControl As Control
For Each FrmControl In Frame1.Controls
FrmControl.Enabled = False
Next FrmControl
Search JabSto ::

Custom Search