![]() |
|
|||||||
| Listviews / Treeviews Anything related to listview and treeview components |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Let say i was created a treeview and that include some parent nodes.Each parent nodes also include some child nodes.So , i want when me double click the treeview component (Private sub..... Handles tv.DoubleClick).It will do something but the problem how i define which child node i selected?
Example : IF e.node.index = 1 Then do something End If but the e.node.index is getting the parent selected node index only ..how to get the child selected node index when i choose child node...
|
|
||||
|
The node selected is e.Node, the Node.Index property refer to the index in the Nodes collection the node belongs to.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
no ..
eg: +Index 1 : A (parent node) - Index 1 :A1 (child node) - Index 2 :A2 (child node) +Index 2 : B (Parent node) when i want double click on A1(child node) , then will do something ,,, but impossible my e.node = 1 de? The IDE will define parent node is selected. Last edited by Lek; 08-12-2008 at 9:50 PM. |
|
||||
|
Except indexes start at 0 your list is correct, so what is the problem?? Trying to explain what you are doing and want to achieve may be a better approach if you need help. You said on mouse event "do something", what is it you want to do? You have the node provided by e.Node.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
wat i want is when i double click my child node (A1) ,,then can do something.
e.g : Private sub tv_db(.......) handles Mouse.DoubleClick If e.node = 1 Then <- because the Parent Node A and child node A1 also same index number ,so how? -> End if i want double the child node to execute smth in my app.what better suggesstion to me about it ? |
|
||||
|
You have the node (e.Node), what else do you need??
Btw, the nodes may have same index number, but it is not the same index since they belong to different treenode collections. Get over it, it is the way it is.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Like John H says, the
Code:
e.node e.g. I use the e.node.Tag for doing specific actions like loading employee records from a form(or more like a subform) into a panel on my parent form that also has the tree. If what John H mentioned doesnt help, try rephrasing your question. I'm also working with the tree control now and the e.node is the real trick to most "which node have i clicked and what should happen " problem Question: Have you set the tag properties for each node in the section of your code for the tree control... e.g. Code:
Dim childrow As DataRow
Dim childnode As TreeNode
childnode = New TreeNode()
For Each childrow In parentrow.GetChildRows("DeptToJob")
childnode = parentnode.Nodes.Add(childrow(0) & " " & childrow(1) & " " & childrow(2))
childnode.Tag = childrow("dept_id")
Code:
e.node.tag e.g. under the Code:
treeView1_afterSelect Code:
textbox1.text = e.node.tag hope this helps Last edited by daPoet; 08-13-2008 at 10:58 AM. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|