Microsoft KB Archive/182943

From BetaArchive Wiki

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

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Add a reference to the Microsoft Windows Common Controls 5.0 by completing the following steps:

    1. From the Project menu, click Components to display the Components dialog box.
    2. From the Controls list, check Microsoft Windows Common Controls 5.0.
    3. Click OK to close the Components dialog box.
  3. Add a toolbar control to Form1. Add some buttons to the toolbar control.
  4. Add a CommandButton to Form1.
  5. Copy the following code to the Code window of Form1:

          Option Explicit
    
          Private Sub Command1_Click()
             Toolbar1.SaveToolbar "NewKey", "NewSubKey", "NewSubKeyValue"
          End Sub
                            
  6. On the Run menu, click Start or press the F5 key to start the program.

    1. Click the command button to add the new registry key, subkey, and value.
    2. End the program.
    3. Run RegEdit.exe to search for "NewKey". Notice that the new registry key you expect (HKEY_CURRENT_USER\NewKey\NewSubKey) does not exist.
    4. Run RegEdit.exe to search for "NewSubKey". Notice that the new registry key is actually HKEY_CURRENT_USER\NewSubKey.


Keywords: kbbug KB182943