I am trying to share mouse events (click, up, down, move and the such) for
30 different label controls: Here is my code:
Dim myLabel as Label
Private Sub lblP1JoyUp_Mous eDown(ByVal sender As System.Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles lblP1JoyUp.Mous eDown
myLabel = lblP1JoyUp
myLabelMouseDow n()
End Sub
Public Sub myLabelMouseDow n()
If e.Button = MouseButtons.Le ft Then
My code here
ElseIf e.Button = MouseButtons.Ri ght Then
My code here
End If
End Sub
The problem is that it tells me "e" isn't declared. Am I missing something
with my handlers? I thought I had this working at one time with help from
Cor but can't find it no how.
Thanks,
John 4 1114
I seem to have found Cor's example and a post from Jay. I'll give it another
go.
John
"jcrouse" <me> wrote in message
news:ur******** ******@TK2MSFTN GP09.phx.gbl... I am trying to share mouse events (click, up, down, move and the such) for 30 different label controls: Here is my code: Dim myLabel as Label
Private Sub lblP1JoyUp_Mous eDown(ByVal sender As System.Object, ByVal e As System.Windows. Forms.MouseEven tArgs) Handles lblP1JoyUp.Mous eDown
myLabel = lblP1JoyUp
myLabelMouseDow n()
End Sub
Public Sub myLabelMouseDow n()
If e.Button = MouseButtons.Le ft Then
My code here
ElseIf e.Button = MouseButtons.Ri ght Then
My code here
End If
End Sub
The problem is that it tells me "e" isn't declared. Am I missing something with my handlers? I thought I had this working at one time with help from Cor but can't find it no how.
Thanks, John
> Private Sub lblP1JoyUp_Mous eDown(ByVal sender As System.Object, ByVal e As System.Windows. Forms.MouseEven tArgs) Handles lblP1JoyUp.Mous eDown
myLabel = lblP1JoyUp
myLabelMouseDow n()
change this to: myLabelMouseDow n(e) End Sub
Public Sub myLabelMouseDow n()
and this to: Public Sub myLabelMouseDow n(ByVal e as
System.Windows. Forms.MouseEven tArgs) If e.Button = MouseButtons.Le ft Then
My code here
ElseIf e.Button = MouseButtons.Ri ght Then
My code here
End If
End Sub
The problem is that it tells me "e" isn't declared.
That's exactly what that means. In the procedure myLabelMouseDow n 'e' hasn't
been declared anywhere.
hope this helps..
Imran.
* "jcrouse" <me> scripsit: I am trying to share mouse events (click, up, down, move and the such) for 30 different label controls: Here is my code: Dim myLabel as Label
Private Sub lblP1JoyUp_Mous eDown(ByVal sender As System.Object, ByVal e As System.Windows. Forms.MouseEven tArgs) Handles lblP1JoyUp.Mous eDown
myLabel = lblP1JoyUp
myLabelMouseDow n()
End Sub
Instead of adding one handler per control, add a common handler. To do
that, add all 30 controls to the 'Handles...' list at the procedure
head's end ('Handles Label1.MouseDow n, Handles Label2.MouseDow n, ...'),
or use 'AddHandler to add the common handler to all of the controls'
'MouseDown' event. Then you can check the event handler's 'sender'
parameter to see which control caused the event:
\\\
Dim SourceControl As Control = DirectCast(send er, Control)
....
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Got it resolved!
Thanks for your patience guys,
John
"jcrouse" <me> wrote in message
news:ur******** ******@TK2MSFTN GP09.phx.gbl... I am trying to share mouse events (click, up, down, move and the such) for 30 different label controls: Here is my code: Dim myLabel as Label
Private Sub lblP1JoyUp_Mous eDown(ByVal sender As System.Object, ByVal e As System.Windows. Forms.MouseEven tArgs) Handles lblP1JoyUp.Mous eDown
myLabel = lblP1JoyUp
myLabelMouseDow n()
End Sub
Public Sub myLabelMouseDow n()
If e.Button = MouseButtons.Le ft Then
My code here
ElseIf e.Button = MouseButtons.Ri ght Then
My code here
End If
End Sub
The problem is that it tells me "e" isn't declared. Am I missing something with my handlers? I thought I had this working at one time with help from Cor but can't find it no how.
Thanks, John
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Simon Neve |
last post by:
Hello,
This question is related to sharing .Net projects across solutions and is
reposted from the SourceSafe group.
We have several different solutions and want to share common assemblies
across them. Is it best to share the project and its files to each solution
(each solution has it's own shared project), or have each solution point to
the same file location of the project?
|
by: cybertof |
last post by:
Hi !
What is the common use of sharing a single .cs across multiple project
files ?
I think it's to share common classes between projects.
I have actually a .cs file shared accross multiple projects in a same
solution. It's nice to have a common "set" of Classes.
Is this the only way to share classes between projects ?
|
by: JoeS |
last post by:
Is there anyway to share a single pch file between
projects in VC 7.0? I have 300+ projects each of which
creates its own pch. All projects include the exact same
header files in the precompiled header. Its takes about 7
seconds to create the precompiled header for each project.
That's 35 minutes spent creating precompiled headers for
all project! All of the projects use PDB files for debug
info.
I tried creating Precomp.pch in project...
|
by: Robert W. |
last post by:
I'm embarking on a project that will have both a desktop application and a
Pocket PC application. It seems logical to have as much code as possible
sitting in a shared project, which would be referenced and utilized by both
the Windows Forms application and the Mobile Device application.
Are there any "gotchas" (ie. warnings) that anyone knows about in following
this approach?
Robert W.
Vancouver, BC
|
by: Shikari Shambu |
last post by:
Hi All,
I have a situation where multiple applications are sharing some pages/
controls.
So, I have a separate common project that has the common pages/ controls.
My question is how do I reference these pages/ controls from my ASP.NET web
projects
WEbApp1 url http://localhost/app1 C:\Apps\App1
| |
by: Nick |
last post by:
Hello,
Please pardon my ignorance as this is something I should know, but I'm a
little unclear. I have an MDI based app. It is setup so the user opens a file
and the main child form is created. Once that is opened one (or more)
properties forms can be opened. What is the best method for sharing data
between the properties forms and the main child form? I need to alert the
main child form when a value is modified in a properties form so I...
|
by: Joe |
last post by:
While I understand that Server Side Includes still work, I realize it's
not the best practice for sharing code such as a common set of includes
between screens.
In ASP.NET I've already built several User Controls and such for sharing
code between screens, but this typically was used things such as menus
and headers and footers.
What is the best practice in 1.1 for sharing code such as a common set
of functions used by multiple screens?
|
by: Max Vit |
last post by:
I have deployed few Access apps splitting it in Front End and Back
End. Our environment uses Win XP SP2 for clients, Win 2k3 for servers
and Access 2003. The max. number of clients is about 50 (concurrent
users is estimated around 10).
Whilst the Back End always lives on a server, I am not quite clear
where the Front End should live.
I have searched the web and find contradicting views.
|
by: Nathan Sokalski |
last post by:
I have a form that contains a number of fields, all of which have
validators. There are two submit buttons, one to update a record and one to
add a record. Because the only difference in validation is to make sure
someone is not using a username that is already in use, I would like to be
able to use all the other validators for both the add and update buttons.
However, because as far as I know a validator can only be in one...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |