Article ID: 182943
Article Last Modified on 11/18/2003
APPLIES TO
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
This article was previously published under Q182943
SYMPTOMS
The SaveToolbar method of the Toolbar control has three arguments that allow you to save a registry key, subkey, and value in the registry. Upon executing this method, only the subkey and value are saved in the registry.
CAUSE
The key argument of the SaveToolbar method is ignored. The following example will actually store the value "Toolbar1" at the registry key HKEY_CURRENT_USER\User1 rather than HKEY_CURRENT_USER\AppName\User1 as you might expect:
Toolbar1.SaveToolbar "AppName", "User1", "Toolbar1"
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
- Start a new Standard EXE project in Visual Basic. Form1 is created by default.
- Add a reference to the Microsoft Windows Common Controls 5.0 by completing the following steps:
- From the Project menu, click Components to display the Components dialog box.
- From the Controls list, check Microsoft Windows Common Controls 5.0.
- Click OK to close the Components dialog box.
- Add a toolbar control to Form1. Add some buttons to the toolbar control.
- Add a CommandButton to Form1.
Copy the following code to the Code window of Form1:
Option Explicit Private Sub Command1_Click() Toolbar1.SaveToolbar "NewKey", "NewSubKey", "NewSubKeyValue" End Sub
- On the Run menu, click Start or press the F5 key to start the program.
- Click the command button to add the new registry key, subkey, and value.
- End the program.
- Run RegEdit.exe to search for "NewKey". Notice that the new registry key you expect (HKEY_CURRENT_USER\NewKey\NewSubKey) does not exist.
- Run RegEdit.exe to search for "NewSubKey". Notice that the new registry key is actually HKEY_CURRENT_USER\NewSubKey.
Keywords: kbbug KB182943