Form Focus

  • Thread starter Thread starter Thore Berntsen
  • Start date Start date
T

Thore Berntsen

I have the following problem:

- In the main form my of application (Form1) I show another form (Form2)
using Show() or ShowDialog()
- While I'm in Form2 i open up another application, say PocketWord.
- I close PocketWord and Form2 get's focus back.
- But when I close Form2 PocketWord gets focus, not Form1 !
- I have tried to call this.Show, this.Focus, this.BringToFront and the API
call SetForeGroundWindow in Form1, but none of that brings Form1 back to the
top with focus.

Can anyone help?

Thore Berntsen
 
If you are able to _close Form2, you can change its "MinimizeBox" property
to False, and place a hook in the close method to return you to Form1.

I was doing something similar w/ multiple child forms. It kept opening a
new (in my app) Form2 but never closed the original.
Changing it to close the child form when switching fixed that. I did have
to handle the data differently, but that was easy to move that handler.

Z Maclean
 
Back
Top