blah blah blah is here! blah blah » Close

up0down
link

It may not be the best way to do this, but i'm trying to use a splash screen to delay form1 loading whilst things go on in the background, i.e all the network drives get mapped and so on.

I'm using a form called "Splash" that gets fired up first then a timer tick event to launch "Form1" the problem is, when i use

this.Hide();
in the timer event the form keeps opening Form1 over and over again, but is i use
this.Close();
it closes the whole application down? is there a better way i can do it?

last answered 2 years ago

1 answers

up1down
link

If I were you I'd leave Form1 as your start up form i.e. in the Main() method in program.cs you need:

Application.Run(new Form1());


Then I'd show the splash form from the Form1_Load eventhandler:
private void Form1_Load(object sender, EventArgs e)
{
Splash splash = new Splash();
splash.ShowDialog();
}

You can then call Close() on your Splash form at the appropriate time without closing the whole application as it will no longer be the start up form.

My problem is that form1 loads data into a datagrid from remote data base, The application is launched from the start up menu so i really wanted to delay the form1 from loading giving all the network connections time to establish ensuring no errors are thrown if the application can't find the databases - i suppose i could place another form in front of form1 that then fires the splash screen?

foamy
2499

To enable form1 to continue loading while the splash screen is visible, use Show in stead of ShowDialog in vulpes' example

Thanks guys - i've got working to do the job.

Feedback