Click here to Skip to main content
14,638,900 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

MenuItems are "clickable", you just need to handle the event on the Menu control.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

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".
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

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
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

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
   
Rate this:
Please Sign up or sign in to vote.

Solution 5

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
   
v3
Comments
Not Active 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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100