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 6636887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:14:35+00:00 2026-05-25T23:14:35+00:00

I’m working on a program that allows me to edit XML data in a

  • 0

I’m working on a program that allows me to edit XML data in a DataGridView. I have most everything working but I don’t like my current TreeView Structure.

I load the XML data into a DataSet and edit it there, so that is what I’d prefer to base my TreeView on. I’ve tried a few things such as..

Private Sub updateTree()
    'Clear All Previous TreeView Nodes
    TreeView1.Nodes.Clear()
    'Loop Through XML Nodes and Add them to the Tree
    For Each table As DataTable In ds.Tables
        Dim node As New TreeNode(table.TableName)
        If table.ChildRelations.Count = 0 Then
            node.Text = table.TableName
            node.Tag = table.TableName
            TreeView1.Nodes.Add(node)
        Else
            node.Tag = table.TableName
            node.Text = table.TableName & " - No Child Objects"
            TreeView1.Nodes.Add(node)
        End If
    Next
End Sub

What I’d really like to have is a tree view that shows the Parent Child objects nested. I’m not sure exactly how to accomplish that in this case… Any ideas?? I found this, article, but don’t have many more leads…

Adding Nested Treeview Nodes in VB.NET?

Thanks.

  • 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-05-25T23:14:35+00:00Added an answer on May 25, 2026 at 11:14 pm

    I found a way to problematically accomplish what I was trying to do. I figured that because the DataSet includes the parent child relationships, I could use those to build my treeview.

    A DataSet includes two Properties, parent relations and child relations. I the count on those to determine where they were at in the relationship tree. Using an if statement, I first Populate the Parent Node, because the top Parent has no Parent. Then I check to see if there is a child to the parent, and populate those, lastly, I use a counter to populate the grandchild node.

    'Sub for calling a treeview update when needed
    Private Sub updateTree()
        'Clear All Previous TreeView Nodes
        TreeView1.Nodes.Clear()
        'Loop Through the database examining the Parent child relationship and Add the nodes to the Tree
        Dim i As Integer = 0
        For Each table As DataTable In ds.Tables
            Dim node As New TreeNode(table.TableName)
            If table.ParentRelations.Count = 0 Then
                node.Text = table.TableName & " -Parent"
                node.Tag = table.TableName
                TreeView1.Nodes.Add(node)
            ElseIf table.ParentRelations.Count = 1 And table.ChildRelations.Count = 1 Then
                node.Tag = table.TableName
                node.Text = table.TableName & "-Child"
                TreeView1.Nodes(0).Nodes.Add(node)
            ElseIf table.ChildRelations.Count = 0 And table.ParentRelations.Count = 1 Then
                node.Tag = table.TableName
                node.Text = table.TableName & "-Grandchild"
                TreeView1.Nodes(0).Nodes(i).Nodes.Add(node)
                i += 1
            End If
        Next 
    

    As always, if anyone has a better idea, I’m all ears:)

    Thanks….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I have two tables with like below codes: Table: Accounts id | username |
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.