Hello! I'm creating a application that involves the tree view, i have this method being called:

public void openproject()
        {
            XmlDocument reader = new XmlDocument();
            reader.Load("EWProjects/" + projectName + "/" + projectName + ".ebw");
            projectName = reader.SelectSingleNode("Project/ProjectName").InnerText;
            addNode();
        }

It reads the title of a 'project' from an XML file (with my own extension) then calls the method addNode. And yes I'm positive that the information is being fetched I have debugged with MessageBox.
So here is the addNode method.

public void addNode()
        {
            TreeNode node = new TreeNode("Example");
            treeView1.Nodes.Add(node);
        }

Nothing is working at all, iv'e tried it in the openproject method as well, nothing is working! I can't get it to work in any method. Someone please help?

Did you call Refresh() on the TreeView anywhere?

Yes my friend told me to do that after I posted this thread, I called it right here:

public void addNode()
        {
            TreeNode node = new TreeNode("Example");
            treeView1.Nodes.Add(node);
            treeView1.Refresh();
        }

And did it fix your problem, since that works for me with the test application I just wrote.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.