Startup form

NekoManu

Regular
Joined
Jul 23, 2004
Messages
75
Location
Belgium
I have a startup form that is displayed for about 10 seconds and than disapears. After that is gone I want the main form.

I was thinking to show the startup form and when that form closes show the main form.

My question is; is that the right way to do it? And if it is how do I do this?

I supposse I need a property where I keep the name of the main form. But how do I get from the property to actually showing the form?

I work in C#. (Or maybe I should say: I try to work in C# ;) )
 
two forms. . . Main and Splash.

Main.OnLoad
{
Splash splash = new Splash();
while splash.Visible {}
splash.Dispose()
}

in Splash. put a timer, set for 10 seconds enabled (activated?) = false;
in splash.OnLoad, start the time. in the timers event set the visible = false;

not at my computer to make sure I have all the methods/events named correctly, but you get the idea.
 
Just set frmSplash as your startup form and set a timer in frmSplash. When the timer expires load frmMain and close frmSplash. Or is frmMain is fairly large and takes a bit of time to load then from frmSplash start frmMain first, then start the timer. When the timer expires close frmSplash.

Or start your project from a module mdlStartup. Use the timer in mdlStartup and regulate the opening and closing of frmSplash and frmMain from there. I think there is an example or two in these forums of this.

Or for a very large frmMain that takes a long time to load, make frmSplash a separate .exe program. Then from frmSplash load frmMain first, then either set a timer or let frmMain load above frmSplash. After frmMain loads, then close frmSplash from frmMain. As a safety, 'cause Win ME does some strange things, also set a timer in frmSplash to close itself after a duration of time that insures that frmMain has loaded 100% from a fresh stratup (this will include the program loading into RAM).

edit: I think PlausiblyDamp has just beat me to the examples.
 
Just set frmSplash as your startup form and set a timer in frmSplash. When the timer expires load frmMain and close frmSplash. Or is frmMain is fairly large and takes a bit of time to load then from frmSplash start frmMain first, then start the timer. When the timer expires close frmSplash.

This is how I have always done it and never had any probs:)
 
This is how I do like a splash screen. And it works great for me. I just start my main form and then during the main form load I display my splash screen. This is in VB .NET but hopefully help and can be translated to c#. I do this because when I start the program I need to load parameters and get info and don't want the operator seeing a blank screen and try to start it again.

Code:
  Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim frmSplash As New frmPorterSplash
        frmSplash.Show()
        frmSplash.pgbLoad.PerformStep()
        Me.comopenclose(1)
        frmSplash.pgbLoad.PerformStep()
        Me.xmldata(False)
        frmSplash.pgbLoad.PerformStep()
        boolDBconnect = Me.checkforDB
        frmSplash.pgbLoad.PerformStep()
        If boolDBconnect Then
            Me.getnamesparts()
        End If
        frmSplash.pgbLoad.PerformStep()
        Me.connectmeter()
        frmSplash.Dispose()
    End Sub
 
Back
Top