handling the focus between two windows forms

  • Thread starter Thread starter Eps
  • Start date Start date
E

Eps

I have two win forms in my app, one for the main gui and another for an
options screen, I also have an ini file which is loaded in after the
InitializeComponent(); is called. If there is no directory set in the
ini file then an instance of the option screen is autmatically created.
This all works fine except the options win form is always behind the
main gui, I have been playing with the various methods Activate(),
Focus(), etc but I can't get my options screen to come on top.

Any help appreciated.

--
Eps

http://ukcomment.blogspot.com/

A UK political Blog
 
hi,

Post some code , probably it's cause you create it before the main form,
what if you set a flag when there is no dir set in the ini file and then in
the main's Form_load event you check for it and if set create * show the
second form , also are you using Hide() on the second form ? or just
creating it each time you need it?

cheers,
 
I would also suggest, given what I know of what you're trying to
achieve, that you want to use .ShowDialog(), not .Show() to show the
options dialog.

That would prevent the user from doing anything with the main form
until after they have dismissed the options dialog.
 
Back
Top