473,320 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Controls Sharing a Context Menu

Is it possible more multiple controls (labels) to share the code from one
context menu. I have 32 labels on a form and don't want to add 32 context
menu controls. Where might I find information on how to do this if possible?

Thanks,
John
Nov 20 '05 #1
3 1355
Hi,,

Take a look at the labels contextmenu property.
http://msdn.microsoft.com/library/de...tmenutopic.asp

Ken
------------------

"jcrouse" <me> wrote in message
news:uH**************@TK2MSFTNGP11.phx.gbl:
Is it possible more multiple controls (labels) to share the code from one

context menu. I have 32 labels on a form and don't want to add 32 context

menu controls. Where might I find information on how to do this if
possible?

Thanks,
John


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #2
you can add just one event handler that handles the mouseup event for all
your labels:

Private Sub AllLabels_MouseUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles _
Label1.MouseUp, Label2.MouseUp, Label3.MouseUp
If e.Button = MouseButtons.Right Then
ContextMenu1.Show(CType(sender, Control), New Point(e.X, e.Y))
End If
End Sub

basically, you add and setup just one context menu (here ContextMenu1) which
you probably already did. As in the code above, you add only one event
handler to handle the mouseup events for all your labels (here Label1,
Label2 and Label3). the rest is self-explanatory.
hope this helps..post back if you have any questions or if this does not
make sense..
imran.

"jcrouse" <me> wrote in message
news:uH**************@TK2MSFTNGP11.phx.gbl...
Is it possible more multiple controls (labels) to share the code from one
context menu. I have 32 labels on a form and don't want to add 32 context
menu controls. Where might I find information on how to do this if possible?
Thanks,
John

Nov 20 '05 #3
Resolved!

"jcrouse" <me> wrote in message
news:uH**************@TK2MSFTNGP11.phx.gbl...
Is it possible more multiple controls (labels) to share the code from one
context menu. I have 32 labels on a form and don't want to add 32 context
menu controls. Where might I find information on how to do this if possible?
Thanks,
John

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Leon | last post by:
Hi! I need to change form's standard context menu code. Eg. I want to order records by my own code. Can I make it, or must I create other context menu and link it to my form?? I'd like to...
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
3
by: Bernie Yaeger | last post by:
The context menu is a form level control. Is there a way to affix a context menu, not to the form, but rather to one of the controls instead? Thanks for any help. Bernie Yaeger
3
by: Just Me | last post by:
I have a usercontrol on which I have, say, five controls. I want a context menu to popup when the mouse is clicked anywhere on the userconttrol. The same context menu. What I've done in the...
1
by: Hardy Wang | last post by:
Hi all, I have a TabControl in my WinForm, I programmatically all tabs to this control, and add some other controls to each tab. I would also like to set a context menu to each tab, BUT what I...
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
2
by: Lucky | last post by:
hi guys, i'm working on the context menu for the controls. the problem i'm facing right now is like this : i want to use one context menu for more then one controls lets say i want to use one...
2
by: Bry | last post by:
I have a context menu which is shared between a TreeView and ListView control (both controls show the same information, similar to how Windows Explorer works, so it makes sense to use the same menu...
1
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got one Context Menu named mi_EasterEggs with three (3) menu items: * mi_FontArial * mi_FontCourier * mi_RawData All menu items have their Visible properties set to False when the form...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.