Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB Visual-Studio VB.NET
Hi,
 
When I initialize a new form to open, the subroutine in the new form starts before the new form is shown on the screen and so when the subroutine finishes and the MsgBox comes up, the form isn't showing.
 
Is there a way to make the form pop up first before the subroutine starts?
 
Thanks a lot for any help
Posted 2-Nov-11 6:45am
RoomTen119

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I reckon you are calling it in the Load event. You need to call it in the Shown event (fired only once).
 
private void Form1_Shown(object sender, EventArgs e)
{
    MessageBox.Show("***");
}
  Permalink  
Comments
RoomTen at 2-Nov-11 12:06pm
   
Well I am calling the subroutine in the Load event, and I just tried calling it in the Shown event as you have said but it still doesn't work. Instead the Form comes up but the subroutine never starts.
Nishant Sivakumar at 2-Nov-11 12:07pm
   
Put a breakpoint and trace through the code.
RoomTen at 2-Nov-11 12:12pm
   
Well actually I managed to get it sorted now using your code. Thanks alot :)
Nishant Sivakumar at 2-Nov-11 16:25pm
   
You're welcome.
LanFanNinja at 10-Nov-11 10:33am
   
+5 for using the word reckon(I'm from the south). :)
Nishant Sivakumar at 10-Nov-11 10:34am
   
LOL :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 Sergey Alexandrovich Kryukov 189
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 2 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100