Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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 =\
0
selectgt
Asked:
selectgt
1 Solution
 
f8bluemistCommented:
well selectgt, thats very very simple...just use global declaraion to track which form has the current focus!
enjoy!
0
 
SethiCommented:
Use Screen.ActiveForm.Name to know the active form in your application
0
 
venyonCommented:
This article should answer your question regarding application focus: http://support.microsoft.com/default.aspx?scid=KB;en-us;q186908

Now for the forms within your application, ff you're using MDI forms, you may use the ActiveForm property to return the active child form. If you're using non-MDI forms, then you may still use Screen.ActiveForm to find out about the same thing.

Hope this helps!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
SethiCommented:
Screen.ActiveForm.Name can be used with both MDI and SDI applications.
0
 
selectgtAuthor Commented:
does screen.activeform.name tell me whether or not my application in general is focused?
0
 
SethiCommented:
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.
0
 
selectgtAuthor Commented:
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.
0
 
selectgtAuthor Commented:
Thank you kind sir, this was exactly what I needed.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now