473,657 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form level focus monitor

I would like to write a routine that will monitor every focus change on the
form and report the name of the control that got focus. I know I could put
code in the gotfocus event of every control and call a central routine, but
is there a way to monitor gotfocus events from one central form level
procedure?

Thanks,

-Steve
Nov 27 '06 #1
4 1176


"Steve" <St***@nospam.c omwrote in message
news:e3******** ******@TK2MSFTN GP04.phx.gbl...
>I would like to write a routine that will monitor every focus change on the
form and report the name of the control that got focus. I know I could put
code in the gotfocus event of every control and call a central routine, but
is there a way to monitor gotfocus events from one central form level
procedure?

Thanks,

-Steve

Not that I'm aware of. What you can do, though, is something similar to
your gotfocus event handler. Create a procedure with the same signature as
your gotfocus event. In your form load event, loop through all controls on
the form (that you want to log when they get the focus) and attach the got
focus event to the procedure you created above. Have this procedure
monitor/log your focus.

HTH,
Mythran
Nov 27 '06 #2

"Mythran" <ki********@hot mail.comwrote in message
news:eu******** ******@TK2MSFTN GP03.phx.gbl...
>

"Steve" <St***@nospam.c omwrote in message
news:e3******** ******@TK2MSFTN GP04.phx.gbl...
>>I would like to write a routine that will monitor every focus change on
the form and report the name of the control that got focus. I know I could
put code in the gotfocus event of every control and call a central
routine, but is there a way to monitor gotfocus events from one central
form level procedure?

Thanks,

-Steve


Not that I'm aware of. What you can do, though, is something similar to
your gotfocus event handler. Create a procedure with the same signature
as your gotfocus event. In your form load event, loop through all
controls on the form (that you want to log when they get the focus) and
attach the got focus event to the procedure you created above. Have this
procedure monitor/log your focus.

HTH,
Mythran

Thanks Mythran,

Sounds like a good idea. Problem is that I'm not sure how to attach the got
focus event to the procedure.
Could I impose on you for some sample code or a hint at where to look in
MSDN?

Thanks again,

Steve

Nov 27 '06 #3


"Steve" <St***@nospam.c omwrote in message
news:O3******** ******@TK2MSFTN GP06.phx.gbl...
>
"Mythran" <ki********@hot mail.comwrote in message
news:eu******** ******@TK2MSFTN GP03.phx.gbl...
>>

"Steve" <St***@nospam.c omwrote in message
news:e3******* *******@TK2MSFT NGP04.phx.gbl.. .
>>>I would like to write a routine that will monitor every focus change on
the form and report the name of the control that got focus. I know I
could put code in the gotfocus event of every control and call a central
routine, but is there a way to monitor gotfocus events from one central
form level procedure?

Thanks,

-Steve


Not that I'm aware of. What you can do, though, is something similar to
your gotfocus event handler. Create a procedure with the same signature
as your gotfocus event. In your form load event, loop through all
controls on the form (that you want to log when they get the focus) and
attach the got focus event to the procedure you created above. Have this
procedure monitor/log your focus.

HTH,
Mythran

Thanks Mythran,

Sounds like a good idea. Problem is that I'm not sure how to attach the
got focus event to the procedure.
Could I impose on you for some sample code or a hint at where to look in
MSDN?

Thanks again,

Steve
Sure, try AddHandler and RemoveHandler :) Look those up in MSDN..

HTH,
Mythran
Nov 27 '06 #4

"Mythran" <ki********@hot mail.comwrote in message
news:O4******** ******@TK2MSFTN GP06.phx.gbl...
>

"Steve" <St***@nospam.c omwrote in message
news:O3******** ******@TK2MSFTN GP06.phx.gbl...
>>
"Mythran" <ki********@hot mail.comwrote in message
news:eu******* *******@TK2MSFT NGP03.phx.gbl.. .
>>>

"Steve" <St***@nospam.c omwrote in message
news:e3****** ********@TK2MSF TNGP04.phx.gbl. ..
I would like to write a routine that will monitor every focus change on
the form and report the name of the control that got focus. I know I
could put code in the gotfocus event of every control and call a central
routine, but is there a way to monitor gotfocus events from one central
form level procedure?

Thanks,

-Steve

Not that I'm aware of. What you can do, though, is something similar to
your gotfocus event handler. Create a procedure with the same signature
as your gotfocus event. In your form load event, loop through all
controls on the form (that you want to log when they get the focus) and
attach the got focus event to the procedure you created above. Have
this procedure monitor/log your focus.

HTH,
Mythran

Thanks Mythran,

Sounds like a good idea. Problem is that I'm not sure how to attach the
got focus event to the procedure.
Could I impose on you for some sample code or a hint at where to look in
MSDN?

Thanks again,

Steve

Sure, try AddHandler and RemoveHandler :) Look those up in MSDN..

HTH,
Mythran

Just what I was looking for. Thanks again.

-Steve

Nov 28 '06 #5

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

Similar topics

2
2685
by: Laurent Bertin | last post by:
Hi i got a strange problem but it's true i don't make thing like anyone... First Config: + IIS5.0 SP2 (yes i know...) WebSite Security Root : Digest Authentication, NT Authenticated SubFolders : Anonymous Login Anonymous login is set to use a domain user to enable a sql server authenticated connection. Permissions are based on Page/action/user Membership
3
3046
by: bradwiseathome | last post by:
I focus on controls in a web form like this: <script language="javascript"> var focusControl = null; if (document.getElementById) focusControl = document.getElementById('txtArea1'); else if (document.all) focusControl = document.all; if (focusControl && focusControl.focus) focusControl.focus();
1
13206
by: Uchiha Jax | last post by:
Standard Framework documentation goes into great detail " A top-level form is a window that has no parent form, or whose parent form is the desktop window. Top-level windows are typically used as the main form in an application." So why is it that standard windows events fail to work in textboxes with ..TopLevel = false forms? ////(inside the load event of a form)
2
1399
by: chuckdfoster | last post by:
I have a form that with a datagrid with textboxes and a submit button. When the user is in a textbox and they hit enter to try to go to a different line, instead they submit the form before they are done entering their data. I know this is how it is supposed to work, but is there anyway to disable the enter key from hitting the submit button? Thanks in advance for any advice! -- Chuck Foster
6
8519
by: Marcus | last post by:
How do I do it in c#? My current solution works sometimes, but sometimes the form comes behind the fullscreen application. I am using the following in the forms constructor this.WindowState = FormWindowState.Normal; this.Focus(); this.BringToFront();
7
11917
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click' and it steals the focus from the user's current application. How can I prevent the hidden WebBrowser from stealing focus? (And better yet can I even suppress that click?_
2
2721
by: AMBLY | last post by:
Hello! Would be grateful for help with this one - a Record level Validation problem I run Access 2000 on XP A form has two fields: 1) fldLevel – it’s an Option Group with 4 choices = 1, 2, 3 and 0. 2) fldStatus – is a limited value-list (Combo) with 3 choices = Unassigned, In-Progress, Complete. Any record in the form cannot be both Level_0 and Status_Complete
0
2075
by: ARC | last post by:
I posted this before, but no response. Hopefully the MVP folks will know the answer. I'm not sure how other's are using the new split form, but what I like about it is I can design the header part of the form with buttons, graphics, etc., then use the lower half as a datasheet. I move the splitter bar to completely hide the detail of the record, and only show the datasheet. This is nice, because I don't have to have a main form for the...
44
584
by: John Dann | last post by:
I'm unclear as to how best to use what I'm terming the top-level CSS selectors, by which I mean selectors like *, html and body. I'm coming at this from trying to understand how best to set font sizes but I seem to have strayed into a broader question. Some CSS guides seem to suggest that a * declaration is good practice for any style sheet, primarily I suppose to set zero defaults for margin and padding for all other relevant selectors...
0
8420
marktang
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...
0
8324
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,...
0
8740
jinu1996
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...
1
8516
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,...
1
6176
isladogs
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...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
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...

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.