Adding New Tree Nodes

This exercise initializes your custom add-in program to add new nodes to the tree node display. You must complete this exercise before the examples later in this section will work.

Add the following code to the IOlapAddIn_ProvideChildNodes method:

Private Sub IOlapAddIn_ProvideChildNodes( _

    ParentNode As DSSAddInsManager.OlapTreeNode, _

    OlapTreeNodes As DSSAddInsManager.OlapTreeNodes)

  On Error GoTo IOlapAddIn_ProvideChildNodes_Err

  If ParentNode.Caption = "OLAP servers" Then

    OlapTreeNodes.Add "Sample Forms", icoForms

  ElseIf ParentNode.Caption = "Sample Forms" Then

    Dim frm As Form

    For Each frm In m_SampleForms

      OlapTreeNodes.Add frm.Caption, icoForm

    Next

  End If

  Exit Sub

IOlapAddIn_ProvideChildNodes_Err:

  Debug.Print Err.Number, Err.Description, Err.Source

  Debug.Assert False

  MsgBox "Provide Child Nodes Failed"

  Err.Clear

  Exit Sub

End Sub

Run the application.

With the Microsoft® Visual Basic® project executing, start the OLAP Manager, and then browse the tree view. You should see the new tree nodes added to the bottom of the tree.

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.