Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contextmenustrip

Status
Not open for further replies.

selimsl

Programmer
Aug 15, 2005
62
TR
Hi!

I am new at vb.net
I am trying to use contextmenustrip.My code is:
Code:
Private Sub Panel1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseClick
        
        ContextMenuStrip1.Show()
End Sub
When I click on the panel,ContextMenustrip open at the upperleft side of the screen.
How can I show ContextMenuStrip1 at the position,which I have determined.

Thanks in advice....
 
The meaning of that menu is to appear when right-click occurs. At the panel1 control, find the property ContextMenuStrip. Select the ContextMenuStrip1

 
hneal98,

it is a regular menu that will be displayed to the user when he right-clicks a control (the has been assigned a contextmenu). An example could be the menu that pops up when you right-click in a textbox (undo, cut, copy, ...).

If you have a vb6 background, you would check if button=2 (right click) and then you would do: popupmenu menu1.
 
Ok, it is a context menu. I wasn't sure about the 'strip' portion of the name. What does your context menu code look like?
 
Didn't get you on "code looks like".

Well, you can create one programmatically at runtime; which is useless and bad idea. (Reason: you have to add the items programmatically, add the handlers etc.). The easy way and recommented is to drag 'n drop one by the toolbox. As soon as you click it, it will aprear its designer at the top of the form
 
ERrrr..

From the TOOLBOX, under section MENUS & TOOLBARS there is the "ContextMenuStrip
 
You must be working in a version I don't have because I don't see any Menus & Toolbars section in the ToolBox.
 
Yes, This is for VS 2005. For 2003 version it is under Windows Form section. "ContextMenu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top