|
-
May 7th, 2008, 09:17 PM
#1
Thread Starter
Lively Member
[RESOLVED] [2005] - TreeView Node and Windows Form
Hi All,
I currently have a TreeView with a bunch of nodes. After clicking on a selected node, I would like to display a windows form. I can assign the form to the "NodeMouseClickEvent", but that will load the same form for every node.
-
May 7th, 2008, 09:34 PM
#2
Re: [2005] - TreeView Node and Windows Form
The NodeMouseClick event handler gives you a reference to the node that was clicked, so you can then display the appropriate form for that node.
-
May 7th, 2008, 10:25 PM
#3
Thread Starter
Lively Member
Re: [2005] - TreeView Node and Windows Form
Possible to get any article links or examples? I tried Google and MSDN but their solutions are not really answering my question.
-
May 7th, 2008, 11:13 PM
#4
Re: [2005] - TreeView Node and Windows Form
As with all event handlers, the data for the NodeMouseClick event is provide via the 'e' parameter. The type of the 'e' parameter changes depending on the event being handled. In this case it's a TreeNodeMouseClickEventArgs object. That class has a Node property that returns a reference to the node that was clicked. You simply check which node that is and open the appropriate form, e.g.
vb.net Code:
Dim node As TreeNode = e.Node If node Is Me.node1 Then 'Open form 1. ElseIf node Is Me.node2 Then 'Open form 2. End If
-
May 7th, 2008, 11:41 PM
#5
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|