1
Answer

Context Menu Difficult to come up - TreeView + Nodes

some one

some one

14y
3.3k
1

Its hard to come up with a subject title for this... 
 
But basicly this is what happens
 
i have a normal context menu attacked to a treeview with a bunch of treeviewnodes in it. so when u right click a node the context menu comes up,
 
however when you right click it dosnt always work, actully it never works at first you have to right click 3 - 5 times before the menu will display...
Any thoughts?
Thanks!
Answers (1)
0
Hirendra Sisodiya

Hirendra Sisodiya

NA 8.8k 3m 14y

Hello
' Can i know that how to set contextmenustrip on treeviewnodes....
if you want to add contextmenustrip on only nodes of treeview
you can use this code:
For Each trv As TreeNode In TreeView1.Nodes
trv.ContextMenuStrip = ContextMenuStrip1
Next
Or
if you want to add only on child nodes,you can use this code:

For Each trv As TreeNode In TreeView1.Nodes
For Each Childtrv As TreeNode In trv.Nodes
Childtrv.ContextMenuStrip = ContextMenuStrip1
Next
Next

thanks
Please mark as answere if it helps