Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
649
How to retrieve data from UltraTreeview?
posted

 HI,

How to retrieve data from UltraTreeview?

i tried the below code. It is not working 'due to 'Object reference not set to an instance' error.


           ' Declare variables for tree
        Dim CdTree As ITestDataTree
        Dim CdTreeNodes As ITestDataTreeNodes
        Dim CdTreeNode() As ITestDataTreeNode

        ' Variables to hold tree data
        CdTree = Tree2().GetTestData("TreeView")
        CdTreeNodes = CdTree.GetTreeNodes() - ----- "Error at this line 'Object reference not set to an instance of an object'"
        CdTreeNode = CdTreeNodes.GetRootNodes()

 

 

' Print out total number of nodes

 MsgBox("Tree Total Node Count: " + CdTreeNodes.GetNodeCount())

MsgBox(

"Tree Root Node Count : " + CdTreeNodes.GetRootNodeCount())

' Iterate through tree branches; this is a recursive method.

        Dim I As Integer

        For I = 0 To CdTreeNode.Length - 1
            ShowTree(CdTreeNode(I), 0)
        Next I

Thanks in advance.

 Rekha. 

 

Parents
No Data
Reply
  • 6729
    Suggested Answer
    Offline posted

    Hi Rekha,

    Try this code: (if you want to iterate through all nodes recursively then you need to implement the "ShowTree" recursive method)

     

     

            Dim CdTree As ITestDataTree

            Dim CdTreeNodes As ITestDataTreeNodes

            Dim CdTreeNode() As ITestDataTreeNode

            ' Variables to hold tree data

            CdTree = Tree2().GetTestData("all tree data")

            CdTreeNodes = CdTree.GetTreeNodes()

            CdTreeNode = CdTreeNodes.GetRootNodes()

            ' Print out total number of nodes

            MsgBox("Tree Total Node Count: " + CdTreeNodes.GetNodeCount().ToString())

            MsgBox("Tree Root Node Count : " + CdTreeNodes.GetRootNodeCount().ToString())

            ' loop through the tree root bands

            Dim I As Integer

            For I = 0 To CdTreeNode.Length - 1

                LogInfo(CdTreeNode(I).GetNode().ToString())

            Next I

     

     

    Regards,

    Ammar

Children