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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:33:01+00:00 2026-06-07T12:33:01+00:00

I have a TreeView in WinForm application, and I am using the add ,

  • 0

I have a TreeView in WinForm application, and I am using the add, reorder and delete methods to add new nodes, reorder existing nodes and delete old notes.

Sometimes when I add a new item it does net show immediately in the TreeView, but it does show correctly when I add the next node. It seems to happen randomly, so it’s difficult to find the root cause.

Even when the node does not show correctly in the UI, the node count is correct.

TreeView1.BeginUpdate();
TreeView1.Nodes.Add("P1", "Parent");

foreach(User u in items)
{
    if( condition)
    {
        node.Text =u.sNodeText; 
        node.Tag = u;
        node.Text = u.sNodeText;                    
        GetChildren(node);
        TreeView1.Nodes["P1"].Nodes.Add((TreeNode)node.Clone());
    }
}            
TreeView1.ExpandAll();
TreeView1.EndUpdate();           
TreeView1.Refresh(); 

Can anyone answer this question? I think the question is not meaningless.
Here is the GetChildren method.

     private void GetChildren(TreeNode node)
    {
        TreeNode Node = null;
        User nodeCat = (User)node.Tag;

        foreach (User  cat in items)
        {
            if (cat.sParentID == nodeCat.sID)
            {
                Node = node.Nodes.Add(cat.sNodeText);
                Node.Tag = cat;
                GetChildren(Node);
            }
        }
  • 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-07T12:33:02+00:00Added an answer on June 7, 2026 at 12:33 pm

    Have you tried Invalidate() versus Refresh()? Refresh only redraws the Client area, while Invalidate redraws the entire control. It’s just a shot in the dark… I’ve never encountered this problem before.

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

Sidebar

Related Questions

In my winform application I have a treeview. To give the idea that a
I have some TreeView's in my winform application. I am trying to make mass
I have a treeview in the winform application.... I added a node to it
In the Winform, i have a UserControl TreeView and It loads real time data
I have a TreeView that launches a new window when each of its TreeViewItems
I'm experimenting with a treeview in a little C#/Winforms application. I have programatically assigned
I have a treeview control. I use keyboard to navigate through nodes. I want
I have a treeview and I wanted to add right click support for the
I have a treeview in my C# code. I want to replace all existing
I have a winform with a listbox and a treeview. Once my listbox is

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.