TreeNode with Image List

A

A-PK

Hi All,

I browse through the msdn.microsoft.com and was able to fine one article
related to Treeview ImageList.

my coding is like the following

Dim rootNode as New TreeNode

rootNode = TreeView1.Nodes.Add("Parent Node")

Dim nodeFirstChild = New TreeNode("FirstChildNode", 1, 2)

nodeFirstChild = rootNode.Nodes.Add(nodeFrist)

' When I tried to add Second Child Node, i will encounter the problem, so I
dun know what to continue. Hope someone could guide me. I was thinking to
code as following for Second Child Node

Dim nodeSecond = New TreeNode("SecondChildNode", 2 , 3)

nodeSecond = nodeFirstChild.Nodes.Add(nodeSecond)

Here, Having problem, but I am only Dim node = new TreeNode ( with out the
imagelist after TreeView ), then everything is working fine. Pls guide
me....



Thank you very much



Regards

Pierce
 
J

Jacob Grass [MVP]

A-PK said:
Dim rootNode as New TreeNode

rootNode = TreeView1.Nodes.Add("Parent Node")

Dim nodeFirstChild = New TreeNode("FirstChildNode", 1, 2)

nodeFirstChild = rootNode.Nodes.Add(nodeFrist)

' When I tried to add Second Child Node, i will encounter the problem, so
I dun know what to continue. Hope someone could guide me. I was thinking
to code as following for Second Child Node

Dim nodeSecond = New TreeNode("SecondChildNode", 2 , 3)

nodeSecond = nodeFirstChild.Nodes.Add(nodeSecond)

Here, Having problem, but I am only Dim node = new TreeNode ( with out the
imagelist after TreeView ), then everything is working fine. Pls guide
me....


The first thing you should probably do is to add Option Explicit On and
Option Strict On at the top of your code files.

What is the error message that you are receiving when you try and call that
nodeSecond line?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top