Hughng Posted July 30, 2003 Posted July 30, 2003 Hello, How can I regain focus on my Form application after calling an external program (dos executable). Here is the sernario: 1. Init the main form A. 2. Form A call an external program (B) which run for about 2 seconds. 3. External progrmam return and A continue the normal code to the end of a init sub routine. For some reason, the focus is not at form A after the external program B run. I have tried "Me.focus" and other method but still could not regain the focus to my form A. Is there anyway I can get it back after program B run? Thank you very much for your help, HN Quote
*Gurus* divil Posted August 9, 2003 *Gurus* Posted August 9, 2003 Try the form's BringToFront method. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Hughng Posted August 11, 2003 Author Posted August 11, 2003 Thank you for your help divil, but bringtofront() does not work because it only apply with in the form. The problem is the whole form goes to inactive window so it does not help. HN Quote
*Gurus* divil Posted August 12, 2003 *Gurus* Posted August 12, 2003 Try the Activate method instead, that seems to do the trick. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Hughng Posted August 14, 2003 Author Posted August 14, 2003 Thank you very much. Activate method did it for me :-). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.