I have a winform application which begin with a splash form in a new thread(I used the . When the splash form closes automatically, a login form instanates in the original thread and hold using LoginForm.ShowDialog. However, although a textbox in the Login Form() get the focus, the application become inactive(user cannot type in the textbox immediatlly). User have to click on the form or use Alt-Tab to switch to the Login Form before they can type on the textbox.
How can I make the application keep its focus after the splash form close

About Threading
AnaC
Smalldust
You are using a difficult and ambigious way to do this:
Try to Create Your SplashForm and put a Timer in that to Close it automatically after X seconds.
Then in Main Form's Contructor:
Do this:
SplashForm splashForm = new SplashForm();
splashForm.ShowDialog(this); //Will Automatically Closed by the internal Timer
splashForm.Dispose();
LoginForm loginForm = new LoginForm();
if(!loginForm.ShowDialog() == DialogResult.OK) // Not Varified
{
Application.Exit();
}
loginForm.Dispose();////
Without Thread you did the same job more clearly and efficiently!
I hope this will solve your problem and will have proper Focus toooo!
Best Regards and Best of Luck!
UniqueDisplayName-Adam
Right! Do it in Main, and put Application.Run(new Form1()); in the else statement, so that it may execute only when the validation is suceeded!
Note: Try to elaborate your problem with Code posting!
I hope this will work!
Best Regards,
samfan
try maybe doing:
this.Focus();
this.Activate();
after the:
LoginForm.ShowDialog();
in your main form - does this help
rndy stllwgn
You have reference to both forms in a single class from where they ran Then Call activate Methods on them checking InvokeRequired property!
What problem are you facing in this
Best regards,
n1c-