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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:36:15+00:00 2026-06-04T15:36:15+00:00

I’ve made some researches and I found some topic close to my problem, but

  • 0

I’ve made some researches and I found some topic close to my problem, but none of them solved it.

populate treeview from a list of path

http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.aspx

http://social.msdn.microsoft.com/Forums/en/winforms/thread/dae1c72a-dd28-4232-9aa4-5b38705c0a97

SharpSvn: Getting repository structure and individual files

I want to make a repository browser for my SVN folder so that the user can choose one folder and it will be return to a text box.

This is my actual code :

    private void sourceTrunkBrowseButton_Click(object sender, EventArgs e)
     {
         using (SvnClient svnClient = new SvnClient())
         {
             Collection<SvnListEventArgs> contents;
             Collection<SvnListEventArgs> contents2;
             List<TreeItem> files = new List<TreeItem>();
             if (svnClient.GetList(new Uri("https://sourcecode/svn/XXXXXX"), out contents))
             {
                 foreach (SvnListEventArgs item in contents)
                 {
                     if (item.Path != "")
                     {
                         files.Add(new TreeItem(item.Path, 0));

                         if (svnClient.GetList(new Uri("https://sourcecode/svn/XXXXX" + item.Path), out contents2) && item.Path != "")
                         {
                             foreach (SvnListEventArgs item2 in contents2)
                             {
                                 if (item2.Path != "")
                                 {
                                     files.Add(new TreeItem(item2.Path, 1));
                                 }
                             }
                         }
                     }
                 }
             }
             svnBrowser_.FillMyTreeView(files);
             svnBrowser_.Show();
         }
     }

And

  public void FillMyTreeView(List<AutoTrunk.TreeItem> files) 
 {

       // Suppress repainting the TreeView until all the objects have been created.
        svnTreeView.BeginUpdate();

        svnTreeView.Nodes.Clear();
        List<TreeNode> roots = new List<TreeNode>();
         roots.Add(svnTreeView.Nodes.Add("Items"));
         foreach (AutoTrunk.TreeItem item in files)
     {
         if (item.Level == roots.Count) roots.Add(roots[roots.Count - 1].LastNode);
         roots[item.Level].Nodes.Add(item.BrowsePath);
     }

        // Begin repainting the TreeView.
        svnTreeView.EndUpdate();
 }

But my tree look like this :

+---Name1
|   |
|   +------Name2
|   |
|   +------Name3
|   |
|   +------Name5
|   |
|   +------Name6
|
+---Name4

but Name 5 and Name 6 should be under Name 4

Sorry for the long post and 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-06-04T15:36:16+00:00Added an answer on June 4, 2026 at 3:36 pm

    if(item.Level == roots.Count) is your problem I’m thinking… Are you sure the items have the correct level? For example, if Name1 and Name4 are roots, then what happens after you’ve encountered your second root? Does this give the intended result:

    TreeNode root = svnTreeView.Nodes.Add("Items");
    TreeNode workingNode = root;
    foreach (AutoTrunk.TreeItem item in files)
    {
        if (item.Level == 0) 
            workingNode = root.Nodes.Add(item.BrowsePath);
        else
            workingNode.Nodes.Add(item.BrowsePath);
    }
    

    Just a thought.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from

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.