Visual Basic Reference

Visual Studio 6.0

ZOrder Method

See Also    Example    Applies To

Places a specified MDIForm, Form, or control at the front or back of the z-order within its graphical level. Doesn't support named arguments.


object.ZOrder position

The ZOrder method syntax has these parts:

Part Description
object Optional. An object expression that evaluates to an object in the Applies To list. If object is omitted, the form with the focus is assumed to be object.
Position Optional. Integer indicating the position of object relative to other instances of the same object. If position is 0 or omitted, object is positioned at the front of the z-order. If position is 1, object is positioned at the back of the z-order.


The z-order of objects can be set at design time by choosing the Bring To Front or Send To Back menu command from the Edit menu.

Within an MDIForm object, ZOrder sends MDI child forms to either the front or the back of the MDI client area, depending on the value of position. For an MDIForm or Form object, ZOrder sends the form to either the front or the back of the screen, depending on the value of position. As a result, forms can be displayed in front of or behind other running applications.

Three graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it. ZOrder arranges objects only within the layer where the object is displayed.