VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 4

ToolBar Control - Customizing Toolbars in Visual Basic 6

Many applications are now allowing users to customize toolbars with their own preferences. You can also provide your users the ability to customize the toolbars you create within your application. The first thing you must do before a user can change your toolbar is to set the AllowCustomize property to True. As long as AllowCustomize is False, the user cannot make changes.

After AllowCustomize is set to True, customization takes place through the Customize Toolbar dialog box, as shown in Figure 4.11.

This dialog box becomes available to the user in one of two ways:

  • The user double-clicks on the ToolBar control.

  • The Customize method of the toolbar is called.

If you will be allowing a user to make changes to a toolbar, you should consider using two additional methods: SaveToolbar and RestoreToolbar. With these two methods, you can save settings from the toolbar in the Windows Registry and then read them back at a later time to restore the appearance of a toolbar either to the original settings or to the user's personal settings when the application is restarted.

The Customize Toolbar dialog box
FIGURE 4.11 The Customize Toolbar dialog box.

The SaveToolbar method has the following syntax:

Toolbar1.SaveToolbar(key As String, subkey As String, value As String)

The RestoreToolbar has the following syntax:

Toolbar1.RestoreToolbar(key As String, subkey As String, value As String)

The key and subkey arguments are the key and subkey of the Windows Registry at which you are storing information or from where you are retrieving information. The value argument is the information that you are saving or reading.

ToolBar Control topics

See Also


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved