Visual Basic: Windows Controls

Customize Method

See Also    Example    Applies To

Invokes the Customize Toolbar dialog box which allows the end user to rearrange or hide Button objects****on a Toolbar control.

Syntax

object.Customize

The object placeholder is an object expression that evaluates to a Toolbar control.

Remarks

The Toolbar control contains a built-in dialog box that allows the user to hide, display, or rearrange buttons on a toolbar. Double-clicking the toolbar calls the Customize method, which invokes the dialog box.

Use the Customize method when you wish to restrict the alteration of the toolbar. For example, the code below allows the user to customize the toolbar only if a password is given:

Private Sub Command1_Click()
   If InputBox("Password:") = "Chorus&Line9" Then
      Toolbar1.Customize   ' Invoke Customize method.
   End If
End Sub

To preserve the state of a Toolbar control, the SaveToolbar method writes to the Windows registry. You can restore a Toolbar control to a previous state using the RestoreToolbar method to read the information previously saved in the registry.