Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

VB.NET Treeview - Problem adding nodes

Avatar of xizor
xizorFlag for Australia asked on
Visual Basic Classic.NET ProgrammingVisual Basic.NET
9 Comments1 Solution663 ViewsLast Modified:
Hi all, I'm trying to teach my self to use the treeview control and i'm having a little trouble, after about 2 hours of searching i resorted to begging for help.... Help!

I have put this code together so far and it works fine so far to start the treeview list of all the folders/files on my C: the BeforeExpand event removes the blank entry and does the recursive loading of all the sub folders/files... this so far is working perfectly.

What I want to do, and whats causing me to go bald, is add my F: G: and H: into the list so they can be displayed as well....

What code do I put in to add a 2nd, 3rd and 4th and so on root entry into the treeview control?

Cheers.
Dim oNode As New System.Windows.Forms.TreeNode
 
        Try
            aNode.ImageIndex = 1
            aNode.SelectedImageIndex = 1
            aNode.Text = "C:"
            TreeView1.Nodes.Add(aNode)
            aNode.Nodes.Add("")
        Catch ex As Exception
            MsgBox("Error Starting List")
            End
        End Try
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric MoreauFlag of Canada imageSenior .Net Consultant
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers