Form Focus Problem
-
Hi i am having a problem in following code, in this code i am trying to start a splash screen then do some work (here i m just sleeping the thread), then close splash and start second form. problem is that when first form closes, focus drops to anything under it, Visual Studios if i m debugging or explorer when running exe. how can i get focus to my second form. static void Main() { frm = new Form2(); Thread splashThread = new Thread(new ThreadStart(startThread)); splashThread.Start(); Thread.Sleep(2000);//For checking frm.Close(); Application.Run(new Form1()); } public static void startThread() { Application.Run(frm); }
-
Hi i am having a problem in following code, in this code i am trying to start a splash screen then do some work (here i m just sleeping the thread), then close splash and start second form. problem is that when first form closes, focus drops to anything under it, Visual Studios if i m debugging or explorer when running exe. how can i get focus to my second form. static void Main() { frm = new Form2(); Thread splashThread = new Thread(new ThreadStart(startThread)); splashThread.Start(); Thread.Sleep(2000);//For checking frm.Close(); Application.Run(new Form1()); } public static void startThread() { Application.Run(frm); }
the call is not made correct. call the splash screen in the Form1 in the page load and call the form1 in the above code. that should solve your problem Regards. Sudhakar D P
-
Hi i am having a problem in following code, in this code i am trying to start a splash screen then do some work (here i m just sleeping the thread), then close splash and start second form. problem is that when first form closes, focus drops to anything under it, Visual Studios if i m debugging or explorer when running exe. how can i get focus to my second form. static void Main() { frm = new Form2(); Thread splashThread = new Thread(new ThreadStart(startThread)); splashThread.Start(); Thread.Sleep(2000);//For checking frm.Close(); Application.Run(new Form1()); } public static void startThread() { Application.Run(frm); }
-
the call is not made correct. call the splash screen in the Form1 in the page load and call the form1 in the above code. that should solve your problem Regards. Sudhakar D P