473,320 Members | 2,048 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.

can you create one "MouseEnter" event handler for multiple controls on a form?

I have a form with a number of text boxes, comboboxes etc. What I would
like to do is create an event handler for the "mouseenter" event for each of
the controls whereby I display information about the control they just
entered (sort of like an extended tooltip). Now, I can certainly create a
separate mouseenter event for each control (too much work, and not very
clever), but what I would like to do is somehow create one event that would
trigger on the "mouseenter" of any control on the form (much less work, and
very clever). Hopefully, this event will pass a "sender" parameter where,
in the event handler, I can determine which control just got entered, and
display the appropriate message for the user. I have scanned all controls
on a form to do other things (formatting, etc), but if I pick up an
arbitrary control from the 'controls' collection how would I go about
defining a mouseenter event for it? If I can do that, I can loop thru all
the controls and programmatically create mouseenter events for them.

I have a feeling that this can somehow be done, but I'm at a loss as how to
go about it. Can anybody give me some ideas as to how this might be done.

Thanks.
Nov 21 '05 #1
3 3941
"JohnR" <Jo******@hotmail.com> schrieb:
I have a form with a number of text boxes, comboboxes etc. What I would
like to do is create an event handler for the "mouseenter" event for each
of the controls whereby I display information about the control they just
entered (sort of like an extended tooltip). Now, I can certainly create a
separate mouseenter event for each control (too much work, and not very
clever), but what I would like to do is somehow create one event that would
trigger on the "mouseenter" of any control on the form (much less work, and
very clever). Hopefully, this event will pass a "sender" parameter where,
in the event handler, I can determine which control just got entered, and
display the appropriate message for the user.


You can either add the handlers at runtime in the 'Handles' part of a
'MouseEnter' event handler ('... Handles Button1.MouseEnter,
Button2.MouseEnter, ...', or you can bind the handler to controls' events
using 'AddHandler' at runtime (see documentation).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
JohnR,

In this message is the standard sample that I made for this.

http://groups-beta.google.com/group/...e2e947da?hl=en

I hope this helps,

Cor
Nov 21 '05 #3
Thanks for the replies, I will use the addhandler at runtime.

John
"JohnR" <Jo******@hotmail.com> wrote in message
news:T1Wve.3202$Q27.1576@trndny02...
I have a form with a number of text boxes, comboboxes etc. What I would
like to do is create an event handler for the "mouseenter" event for each
of the controls whereby I display information about the control they just
entered (sort of like an extended tooltip). Now, I can certainly create a
separate mouseenter event for each control (too much work, and not very
clever), but what I would like to do is somehow create one event that would
trigger on the "mouseenter" of any control on the form (much less work, and
very clever). Hopefully, this event will pass a "sender" parameter where,
in the event handler, I can determine which control just got entered, and
display the appropriate message for the user. I have scanned all controls
on a form to do other things (formatting, etc), but if I pick up an
arbitrary control from the 'controls' collection how would I go about
defining a mouseenter event for it? If I can do that, I can loop thru all
the controls and programmatically create mouseenter events for them.

I have a feeling that this can somehow be done, but I'm at a loss as how
to go about it. Can anybody give me some ideas as to how this might be
done.

Thanks.

Nov 21 '05 #4

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

Similar topics

5
by: 2003et | last post by:
How To Create Transparent Windows Controls? Thanks
1
by: Csharper95 | last post by:
I am currently working on completing a program that someone else started. The problem (when the program is running): When more than one document/file is opened, the mouse changes the active...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
12
by: Peter | last post by:
I'm looking to create multiple textboxs that change to a light blue on focus. What is the most efficient way to do this? -Peter
0
by: Pucara | last post by:
Hi all, I have noticed that the picturebox object doesnt' fire correctly the mouseEnter mouseLeave events. The problem is seen ONLY when you show a form more than once. You can reproduce it...
5
by: Simon Verona | last post by:
I have an inherited datagrid which has a "double-click" even which returns the row that has been clicked on - this can be consumed by the form (etc) that hosts the control to open another window...
8
by: gs | last post by:
I was able to set tooltips on objects other than main menu. I would like to get the effect of tooltip or microhelp in the bottom status bar when the mouse is hovering over a submenu item. How do...
7
by: Martijn Mulder | last post by:
There are 2 ways to hook an event to a method. For example, to hook the MouseEnter-event, you can use MouseEnter+=OnMouseEnter; or MouseEnter+=new System.EventHandler(OnMouseHandler); ...
12
by: Marc | last post by:
Hi, How can i increase the mousehover event timer? AddHandler NewBtn.MouseHover, AddressOf Shownotes Private Sub Shownotes(ByVal sender As System.Object, ByVal e As System.EventArgs)...
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...
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...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.