Link to home
Start Free TrialLog in
Avatar of selectgt
selectgt

asked on

Find which form has the focus

Within my project, i'm looking to find whether

a) my application has the current focus and
b) if so, which form within my application has the current focus.

for b) i'd like to use the Forms collection if possible ..

i'd like to stay away from having to use a Global declaration to track which form has the current focus by using the Activate() event.  That just feels like bad programming =\
Avatar of f8bluemist
f8bluemist

well selectgt, thats very very simple...just use global declaraion to track which form has the current focus!
enjoy!
Use Screen.ActiveForm.Name to know the active form in your application
ASKER CERTIFIED SOLUTION
Avatar of venyon
venyon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Screen.ActiveForm.Name can be used with both MDI and SDI applications.
Avatar of selectgt

ASKER

does screen.activeform.name tell me whether or not my application in general is focused?
Yes it will, becuase whenever your application is focused you will have one of the forms in the application with the focus and this method will tell you that.
Sethi: I also wanted to know when my application didn't have the focus as well.  You solved half my problem, and thank you for that.. but the entire question was answered by venyon and his solution did work for me.


Thanks a bunch you guys.
Thank you kind sir, this was exactly what I needed.