One last code question and I'll leave you all alone

fantasma62

Newcomer
Joined
Nov 23, 2002
Messages
18
Location
Miami, Florida
I promise this is it, I have bothered you enough....
I have set up a Splash Screen so that when the 5 second timer ends, the Parent form will be displayed.....
I have set up a module to set off the Splash Form and I have put in a timer in the frmSplashScreen.
However, once the 5 seconds have elapsed, the program stops running and doesn't display the frmMdiParent........
???
 
You don't have to leave us alone, it's kinda what we're here for :)

For something like this, you'll want to modify your project startup object. By default your program message loop is set up for one form, but if you want to hide and show another before your main one is displayed, you'll need to change it a little.

Go in to your project properties (right click on the project, select properties) and where it says Startup object, select Sub Main. Then create yourself a new class (or you can use an existing one) and make the following method:

Visual Basic:
    Public Shared Sub Main()
        Dim x As Form2 = New Form2()
        x.Show()

        Application.Run()
    End Sub

Replacing Form2 with the name of your splash screen, obviously. I'm assuming there is a timer on your splash screen form which, when it fires, will close and dispose of itself and open a new main form.

The only other change you'll need to make is to explicitly shut down your program's message loop. To do this, catch the Closed event of your main form, and in it put this line:

Visual Basic:
Application.Exit()
 
Hmmm, I don't see the closed event in my main form. I imagine you mean the frmMdiParent form.....Again, sorry for my lack of knowledge, but I am a beginner....I already placed the SubMain in the frmSplashScreen....
 
I said you could put the Sub Main wherever you like, it doesn't matter.

In the code for your main form, select Base Class Events from the left-hand dropdown at the top of the editor, and then Closed from the right...
 
sorry, as I finished writing my last post, I got what you wanted me to do.....
What's happening is that when the splash screen's timer ends, the Parent form, which is the one that I want to display, flashes and the application closes.....
As you can plainly see, my instructor doesn't exactly instruct.....Thus, I don't know things that I am supposed to know....
 
I suggest you buy a book. In this thread I have given you ample information and walked you through the process of doing what you're trying to do.
 
Sorry, I have 4 different books and none talk about that....
Thanks for the information, you have provided...
Again, I am sorry for my lack of information....
 
Success. I got it to work, I had simply forgotten to add the frmParent.show at the Tick event of the splash screen....
Thank you again for your help....I hope that when I have learned enough, I'll be able to help out another....
Thanks..
 
Back
Top