Microsoft Office Tutorials and References
In Depth Information
Table 19-2. Key Properties, Methods, and Events of the UserForm Controls
Property: when True , means that the control is displayed on the
Property: contains the width of the control in points.
ZOrder (zPosition)
Method: moves the control to the front ( fmTop ) or the bottom
fmBottom ) of the z-order. (
The Height , Width , To p , and Left properties dictate the physical size and placement of the
control on the form. The Enabled property determines if the control can receive the focus,
whereas the Visible control determines whether the control will be drawn. When the Locked
property is Tr ue , the user can manipulate the contents of the control but will be unable to
change its value. For instance, setting the Locked property to Tr ue means that the user could
scroll through a large, multi-line text box to see all of the data. If the Enabled property were
set to False , the text box control would still be visible, but the user would be unable to scroll
to see any text that isn’t currently visible on screen.
When two controls overlap, the ZOrder method controls which one is completely visible and
which one is partially or totally hidden. Moving a control to the top of the z-order means that
it will be displayed last—thus ensuring that the control will be visible even if it overlaps any
other controls. Likewise, using ZOrder to move a control to the bottom means that it will be
rendered first, and any other control that is rendered later might hide this control from view.
Ta bIndex identifies the order in which the focus will shift from one control to the next when
the user presses the Tab key, and Ta bStop determines whether the control will accept the focus
or the focus should shift to the control with the next higher Ta bIndex value. The Enter and
Exit events are fired as the focus shifts from one control to the next on the form. The Exit
routine contains a single argument called Cancel , which you can set to Tr ue to prevent the
user from switching to a different control.
Tip Checking Information
Because the code in the Exit event is only executed when the user switches to another con€
trol, it’s an excellent time to examine the contents of the control to determine if the value
is correct. For example, you can verify that the contents of the control are numeric, and if
the user entered an invalid value, you can notify the user using a message box and then set
the Cancel argument to True , thus preventing the user from switching to a new control on
the same form.
The exact meaning of the Va flue property depends on the control, but in general it contains
the value associated with the control. When this value changes, the Change event is fired.
Remember that the Va flue property is different from the Caption property in that the Caption
property usually represents a block of text that can be changed only by the program, whereas
the Va flue property usually contains information that can be changed by the user interacting
with the form.
Search JabSto ::

Custom Search