Say, for example, I have a ToolStripMenu. I have a tab already made (let’s call it Download), and want a substrip of it (the “type here” part) to be automaticaly made. I want it to be text that the string downloadedString is. Then, later, when it’s clicked, I want it to fire:
Process.Start("google.com/" + Text of the substrip clicked);
How do I do this?
You can do so via the Click event handler on the
ToolStripMenuItem.Part 1 – programmatically adding menu items
Just add a new
ToolStripMenuItemto theMenuStriplike so:They can all reference the same event handler (see below).
Part 2 – event handler to start your process
The event handler will start the process, using the text of the menu item that was clicked:
Based on the code above,
Process.Start()will receivegoogle.com/whateveras the parameter.