Click here to Skip to main content
15,885,871 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i have a small program where i create a list of favorites and add them to a toolstrip menu programatically
is there any way to make the items clickable so i can actually follow the links

i added them through

ToolStripMenuItem item = new ToolStripMenuItem(favourite.URL);
                linksToolStripMenuItem.DropDownItems.Add(item);


which property do i use to actually make them clickable?
i was thinking something in the lines of
using a click eventhandler but can't seem to figure this one out by myself >.<<br mode="hold" />
thanks in advance
Posted

MenuItems are "clickable", you just need to handle the event on the Menu control.
 
Share this answer
 
Add this after that code:

item.Click += 


(and then hit tab a few times and let intellisiense fill it in for you. At that point, you'll be able to put code into the method provided and the menu item will be "clickable".
 
Share this answer
 
According to MSDN documentation the ToolStripMenuItem type has a Click event. So all you have to do in your code is to attach an event handler to it.

Cheers!

--MRB
 
Share this answer
 
You are on the correct path... you have an example here

http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripitem.click.aspx[^]

Note: ToolStripMenuItem inherit from ToolStripItem
 
Share this answer
 
im a bit further now
im just trying to figure out how i can call my own data now...
it seems i need to access the "dropdownitems"-- DOH!!
but i actually have no clue what so ever on how to get the values of my dropdownitems
any ideas?
btw thanks alot for all the responses

think i need to work on my explanation skills
 
Share this answer
 
v3
Comments
[no name] 21-Jun-11 22:35pm    
Answering yourself and marking it as the accepted answer is very poor form
alekcarlsen 22-Jun-11 0:04am    
was actually unintended - fixed - actually think it marked it as a solution by itself - i failed to see the comment button. - but hey thanks for noticing and thinking "douch" instead of "newbie mistake" (Y)

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