Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:59:26+00:00 2026-06-15T21:59:26+00:00

I am populating a tree view dynamically so I do not know the amount

  • 0

I am populating a tree view dynamically so I do not know the amount of levels I may have.

Is there a way to rollback to the previous level? Here is a sample of my code:

Private Sub RecursiveTreeAssembly(FileName As String, node As TreeNodeCollection)
    'Sets sFileNamePath to correct path value
    FileNameToFilePath(FileName)

    'Start SolidEdge
    StartSolidEdge()

    'Open document
    OpenSolidEdgeDocument(sFileNamePath)

    'Get the parts list for the opened document (FileName)
    partList = clsPartInformation.GetAll()

    'Populate tree View
    If partList.Count > 0 Then
        'PartsList retrieved, close document
        CloseSolidEdgeDocument(FileName)

        'Go through all part lists and display them in tree view
        For i As Integer = 0 To partList.Count - 1
            'Is it Assembly, Parametric, Material, Part to buy
            If IsAssembly(partList(i).Part_No) Then
                node(iterator).Nodes.Add(partList(i).Part_No)
            ElseIf IsMaterial(partList(i).Part_No) Then
                node(iterator).Nodes.Add(partList(i).Part_No)
            ElseIf IsPart(partList(i).Part_No) Then
                node(iterator).Nodes.Add(partList(i).Part_No)
            End If

            tvDessins.ExpandAll()
        Next
    End If

    'Go through tree view to populate it
    While iterator < tvDessins.Nodes(0).Nodes.Count
        If rollback Then
            node = tvDessins.Nodes
            currFileName = node(0).Nodes.Item(iterator).Text
        Else
            currFileName = node(iterator).Nodes.Item(0).Text
        End If

        If IsAssembly(currFileName) Then
            rollback = False
            'Call itself again
            RecursiveTreeAssembly(currFileName, node(0).Nodes)
        Else
            'Rollback nodes
            rollback = True
        End If

        iterator += 1
    End While
End Sub

tvDessin is my tree view. In the following code, I will iterate through a tree view that has been given some items recursively. My parts list contains the part number, that works great.

It is during my rollback that I set the tree nodes to the beginning:
node = tvDessins.Nodes

Instead of simply going to the parent node … That’s what I’m looking to achieve!

Thank you, sorry for such a long post.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:59:27+00:00Added an answer on June 15, 2026 at 9:59 pm

    I figured it out.

    Here’s the answer:

    If rollback Then
        currFileName = node.Item(0).Parent.Nodes(iterator).Text 'retrieves parent
    Else
        currFileName = node(iterator).Nodes.Item(0).Text
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so I'm populating an accordion with JSON data. The only way I know
I am populating the list view with data I am getting from a JSON
We have accounting software populating the name field on a magento webstore, the problem
I have a Jstree populating a list of items. When I click a node
I have a simple script using a ttk.Treeview instance that I'm populating with the
I have a multi-paned form, in the left pane is a tree and in
Hello and thanks for the help. I have a Treeview that I am populating
I am populating an array with string objects. There can be thousands of these.
I have a TreeView I'm populating and adding a ContextMenu to each item. The
I have a tree that gets populated through the web service - this part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.