Visual Basic: Windows Controls

Visual Studio 6.0

Panels Collection

See Also    Example    Properties    Methods    Events

A Panels collection contains a collection of Panel objects.



The Panels collection syntax has these parts.

Part Description
statusbar An object expression that evaluates to a StatusBar control.
Index An integer or string that uniquely identifies the object in the collection. The integer is the value of the Index property of the desired Panel object; the string is the value of the Key property of the desired Panel object.

The Panels collection is a 1-based array of Panel objects. By default, there is one Panel object on a StatusBar control. Therefore, if you want three panels to be created, you only need to add two objects to the Panels collection.

The Panels property returns a reference to a Panels collection.

To add a Panel object to a collection, use the Add method for Panel objects at run time, or the Panels tab on the Properties Page of the StatusBar control at design time.

Each item in the collection can be accessed by its Index property or its Key property. For example, to get a reference to the third Panel object in a collection, use the following syntax:

Dim pnlX As Panel
Set pnlX = StatusBar1.Panels(3)   ' Reference by index number.
   ' or
Set pnlX = StatusBar1.Panels("Third")   ' Reference by unique key.
   ' or
Set pnlX = StatusBar1.Panels.Item(3)   ' Use Item method.