Microsoft KB Archive/250314

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


PRB: Visual Basic Snap-In Designer Run-Time Error 9554 When Clicking Static Node

Article ID: 250314

Article Last Modified on 3/20/2004



APPLIES TO

  • Microsoft Visual Basic 6.0 Professional Edition



This article was previously published under Q250314

SYMPTOMS

Programmatically expanding the Static Node at run time may cause the following error message to be displayed:

Run-time error "9554": The scope node is not connected to MMC. This can happen with the static node before it is expanded.

CAUSE

If the Static Node has not been expanded by the user by either double-clicking the Static Node or by clicking the plus sign next to the Static Node, the ExpandInNameSpace method displays the error message shown in the "Symptoms" section.

RESOLUTION

The Static Node must be expanded manually by the user.

MORE INFORMATION

The following code demonstrates this error. Using the Views_AddTopMenuItems code below, the call to open the Static Node causes the error message:

Private Sub Views_AddTopMenuItems(ByVal View As SnapInLib.View, _
                                  ByVal Selection As SnapInLib.MMCClipboard, _
                                  ByVal ContextMenu As SnapInLib.ContextMenu, _
                                  InsertionAllowed As Boolean)
                                  
    With Selection.ScopeItems(1)
        'Check to see if the current ScopeNode has been
        'expanded and if only a sigular ScopeNode has been
        'selected.
        If .ScopeNode.ExpandedOnce = False And Selection.SelectionType = siSingleScopeItem Then
            'Expand the currently selected ScopeNode
            .ScopeNode.ExpandInNameSpace
            'Add Context Menu.
            ContextMenu.AddMenu mnuMain
        End If
    End With
    
End Sub
                

This error is rare because the Static Node object is normally fully loaded before other methods attempt to expand the node.

Keywords: kbprb kbsnapin kbdswmanage2003swept KB250314