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!
Context Menu Difficult to come up - TreeView + Nodes
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Hirendra SisodiyaRank #258 · 9.8K reputationPosted Apr 20, 2010, 9:40 PM EDT
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