473,320 Members | 1,841 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.

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 1152


"Steve" <St***@nospam.comwrote in message
news:e3**************@TK2MSFTNGP04.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********@hotmail.comwrote in message
news:eu**************@TK2MSFTNGP03.phx.gbl...
>

"Steve" <St***@nospam.comwrote in message
news:e3**************@TK2MSFTNGP04.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.comwrote in message
news:O3**************@TK2MSFTNGP06.phx.gbl...
>
"Mythran" <ki********@hotmail.comwrote in message
news:eu**************@TK2MSFTNGP03.phx.gbl...
>>

"Steve" <St***@nospam.comwrote in message
news:e3**************@TK2MSFTNGP04.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********@hotmail.comwrote in message
news:O4**************@TK2MSFTNGP06.phx.gbl...
>

"Steve" <St***@nospam.comwrote in message
news:O3**************@TK2MSFTNGP06.phx.gbl...
>>
"Mythran" <ki********@hotmail.comwrote in message
news:eu**************@TK2MSFTNGP03.phx.gbl...
>>>

"Steve" <St***@nospam.comwrote in message
news:e3**************@TK2MSFTNGP04.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
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...
3
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...
1
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...
2
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...
6
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...
7
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'...
2
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,...
0
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...
44
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: 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.