[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Simple treeview question

Posted on 2000-01-28
3
Medium Priority
?
151 Views
Last Modified: 2010-05-02
I have built a treeview with several nodes.......however.

I now want to assign separate events to each of the nodes, I have already coded the actual events but how do you declare an individual node as a sub procedure.

eg

Within the treeview one of my nodes  looks like this....

Set nodX = TreeView1.Nodes.Add("r", tvwChild, "c1", "Load")

So, how do I assign a NodeClick event to this individual node

ie

Private Sub............................................................

Cheers,

Matt.
0
Comment
Question by:Matt_Unsworth
3 Comments
 
LVL 7

Accepted Solution

by:
Vbmaster earned 120 total points
ID: 2396096
You don't, you use the NodeClick event and check the value of the Node parameter. You can use something like this

Select Case Node.Key
Case "c1"
  'Put code that is to happen when the user press the node with key c1 here
  'or you could call a procedure if you want to make it easier to read
Case somethingelse
Case somethingelse
..
..
End Select
0
 
LVL 3

Expert Comment

by:Gordonp
ID: 2396197
You cannot assign a seperate event to each Node. You have to use the events provided.

You could probably subclass the treeview , but then its no longer a "Simple Treeview Question"

The NodeClick event passes a reference to the Node that was clicked so use a
Select Case, to handle the different nodes.

Use the Tag property to hold an extra id data, remember in the Common Controls that come with VB6 can have objects in the Tag property.

Gordon
0
 

Author Comment

by:Matt_Unsworth
ID: 2396348
Thanks,

Matt
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question