Microsoft KB Archive/182943

= BUG: "Key" Argument of SaveToolBar & RestoreToolBar Doesn't Work =

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.



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.</ol> </li> Add a toolbar control to Form1. Add some buttons to the toolbar control.</li> Add a CommandButton to Form1.</li>  Copy the following code to the Code window of Form1: Option Explicit

Private Sub Command1_Click Toolbar1.SaveToolbar "NewKey", "NewSubKey", "NewSubKeyValue" End Sub </li> On the Run menu, click Start or press the F5 key to start the program.

<ol style="list-style-type: lower-alpha;"> Click the command button to add the new registry key, subkey, and value.</li> End the program.</li> Run RegEdit.exe to search for "NewKey". Notice that the new registry key you expect (HKEY_CURRENT_USER\NewKey\NewSubKey) does not exist.</li> Run RegEdit.exe to search for "NewSubKey". Notice that the new registry key is actually HKEY_CURRENT_USER\NewSubKey.</li></ol> </li></ol>

Keywords: kbbug KB182943

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.