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 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
"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
"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
"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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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'...
|
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 its an Option Group with 4 choices = 1, 2,...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
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
|
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...
| |