Adds a Button object to a Buttons collection and returns a reference to the newly created object.
Syntax
object.Add(index, key, caption, style, image)
The Add method syntax has these parts:
Part | Description |
object | Required. An object expression that evaluates to a Buttons collection. |
index | Optional. An integer specifying the position where you want to insert the Button object. If no index is specified, the Button is added to the end of the Buttons collection. |
key | Optional. A unique string that identifies the Button object. Use this value to retrieve a specific Button object. |
caption | Optional. A string that will appear beneath the Button object. |
style | Optional. The style of the Button object. The available styles are detailed in the Style Property (Button Object). |
image | Optional. An integer or unique key that specifies a ListImage object in an associated ImageList control. |
Remarks
You can add Button objects at design time using the Buttons tab of the Properties Page of the Toolbar control. At run time, use the Add method to add Button objects as in the following code:
Dim btnButton as Button
Set btnButton = Toolbar1.Buttons.Add(, "open", , tbrDefault, "open")
You associate an ImageList control with the Toolbar through the Toolbar control's ImageList property.