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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:38:15+00:00 2026-06-10T01:38:15+00:00

I am playing around with the treeview control and have run into a simple

  • 0

I am playing around with the treeview control and have run into a simple problem. I would like to set it up as everything that is divisible by 10 as being the parent node, then the numbers underneath should be the child nodes, until it reaches another divisible number by 10 without a remainder. So my method looks like this and needs help! Thanks.

        private  void countDown(int num)
    {
        tv_NumList.Nodes.Add("topNode");
        while (num != 0)
        {
            if (num % 10 == 0)
            {
                tv_NumList.Nodes.Add(num.ToString());

                int counter = 9;
                while (counter != 0)
                {
                    tv_NumList.Nodes[1].Nodes.Add(num.ToString());
                    counter--;
                }
                num--;
            }

        }
    }
  • 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-10T01:38:17+00:00Added an answer on June 10, 2026 at 1:38 am

    Maybe it is me, but I can’t see what you’re looking for… assuming you mean this (given 15)

    root 
      |--15
      |--14
      |--13
      |--12
      |--11
     [+]-10
    
    
    root 
      |--15
      |--14
      |--13
      |--12
      |--11
     [-]-10
         |-- 9
         |-- 8
         |-- 7
         |-- 6
         |-- 5
         |-- 4
         |-- 3
         |-- 2
         |-- 1
    

    The following would (untested) give you this result.

    // changed to take TV as a parameter.
    private void countDown(TreeView tv, int num)
    {
        // Create and remember your root node.
        var root = new TreeNode("root");
        tv.Nodes.Add(root);
    
        // This to remember the last 'grouping node' created.  Start with
        // the root node to deal with starting values not divisible by 10.
        TreeNode group = root;
    
        for ( int i=num; i>0; i--)
        {
            // Is it divisble by 10, if so, start a new group 
            if (num % 10 == 0)
            {
                group = new TreeNode(i.ToString());
                root.Nodes.Add(group);
            }
            else
            {  
                // Not divisible, so add to last group (or root if no 
                // group yet started) 
                group.Nodes.Add(i.ToString());
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been playing around with Simple.Data and have run across something that I can't
Playing around a bit more with jqTouch and am running into a problem with
Just playing around with subqueries in SQL Server (I know that this problem doesn't
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there
Playing around with customizing the appearance of the Wizard control in ASP.Net, and I've
While playing around with the emulator, I noticed that when trying to view a
I have been playing around with various methods of making the Visitor pattern in
I'm just playing around with some code but it seemed to have the specific
Playing around with Google Maps these days, with some directions. I have a map
playing around with a property file i figured that there seems to be a

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.