handling the focus between two windows forms

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

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,
 
B

Bruce Wood

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top