o.k. i am writing a program and i want to have a menu pop-up by the mouse when i right click. how exactly do i do that.I have no idea where to start,could someone help me out. Thanks!!
Printable View
o.k. i am writing a program and i want to have a menu pop-up by the mouse when i right click. how exactly do i do that.I have no idea where to start,could someone help me out. Thanks!!
right click popup code. Just put this in the contructor for your form. Inhertiance takes care of the the detecting right click so you dont need to code that part.
Code:Dim mnuContext As ContextMenu
Me.mnuContext = New ContextMenu()
mnuContext.MenuItems.Add(New MenuItem("Unzip", New EventHandler(Me.mnuUnzip_Clicked)));
controltorightclickon.ContextMenu = mnuContext
o.k i see the code but everywere i put it it either showe errors or it does not work. Now i know you know what you are doing so it has to be me doing something wrong.could you tell me were exactly to put it?
it needs to be put in the contructor of the form..in other words the Sub New()
i want to run be running a thread behind the form that will detect a right click of the mouse at any point on the form and put the same contextmenu up for everything right clicked. i do not know how to detect a right mouse click for everything on a thread that is running seperately from the form. what can i do??????
controltorightclickon.ContextMenu = mnuContext
just do that for every control that will use the same menu.