Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a quick Question regarding treeview control. I have a project with a Treeview control with 1 main node and 3 child nodes. When a user selects the child nodes, i want them to run an external program.

How can i make a selected child node run certain application.

+Programs
    +Notepad     (process.start("notepad.exe"))
    +MS Paint    (process.start("mspaint.exe"))
    +Calculator  (process.start("calculator.exe"))





Any Help would be fantastic!

Cheers
Posted

1 solution

Looks like you already know that Process.Start[^] allows you to execute any executable from within your program.

Now, On node click, you can use a switch case. In it, based on the node text (or any other identifier), use Process.Start and launch the desired application.
 
Share this answer
 
Comments
SIFNOk 7-Mar-11 15:07pm    
Thanks for your reply Sandeep :)

i am having difficulty implementing the code. i have selected "On Node Click" as the event...and how do i make it run notepad, if the index is 1?

trvmenu.nodes(1).
Sandeep Mewara 8-Mar-11 0:16am    
Either during the bind, use a fixed ID with each node to determine the node and then execute the process accordingly
OR
Use selectednode.text to help you out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900