Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Splash Screen in C#

timer

  • Please log in to reply
25 replies to this topic

#13 Kierien

Kierien

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 22 January 2010 - 01:29 AM

thank you

I was having troubles with the end of the application

good tutorial

and for timer1 code just double click on the timer


No probs :)
  • 0

#14 soumyo

soumyo

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 13 May 2010 - 02:23 AM

Awesome dude.....thanks for this...just as I wanted for my project :cool:
  • 0

#15 MrrQ

MrrQ

    CC Lurker

  • Just Joined
  • Pip
  • 5 posts

Posted 28 August 2010 - 04:28 AM

That is a great tutorial. I've started 2 implemant it in my skul assgnments. Big ups!
I was wondering if u added a progressBar to the splash, will it nid u to delay the timer.
  • 0

#16 TNDave

TNDave

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 December 2010 - 09:38 AM

Just found this. Major help for a newbie to C# :c-grin:. +rep
  • 0

#17 sam_coder

sam_coder

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 380 posts

Posted 09 December 2010 - 10:27 AM

Go back to Form1 now, and click the "Events" button (Looks like a lightning icon), and scroll down to "FormClosed", and double click it, it should bring you to the code editor. Now add this code

Application.Exit();

The reason behind this is because when Splash closes, its actually still running in the background, but just not visible, as because it is the startup form, which C# thinks is the main form, but by adding this code whenever your Form1 closes the whole application closes.



Hey! Nice Article!

I just though I could shed some light on this specific section of the article. The reason you need to add Application.Exit() is because When you use
Application.Run(splash), this is because this begins running the standard application message loop on the current thread and adds an event handler to Closed for the splash screen to Call Exit Thread.
If it were Form1 that were called with Application.Start, it should terminate the application when that main form is closed.

One possible work wound would be something to the effect of....

main() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            [COLOR="red"](new Splash()).ShowDialog();
            Application.Run(new Form1());[/COLOR]
}

And then of course changing the timer code to just :

this.Close();

Anyways, just thought I'd share. Again, nice article!

Edited by sam_coder, 09 December 2010 - 10:28 AM.
messed up my closing CODE tag...

  • 0

#18 Sp32

Sp32

    CC Regular

  • Just Joined
  • PipPipPip
  • 26 posts

Posted 09 January 2011 - 12:56 PM

When I add the code in the timer1 it comes up as:

[FONT=monospace]
[/FONT]Form1 MainForm = new Form1[COLOR=red];[/COLOR]
[COLOR=red]MainForm.Show;[/COLOR]
timer1.Enabled = false;
this.Dispose(false);
It has a red squiggly line under MainForm.Show; and the semi colon before it, why is this?
  • 0

#19 sam_coder

sam_coder

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 380 posts

Posted 09 January 2011 - 12:57 PM

show is a method

try MainForm.Show();
  • 0

#20 sam_coder

sam_coder

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 380 posts

Posted 09 January 2011 - 12:58 PM

also for new Form1, you will need
Form1 MainForm = new Form1();
  • 0

#21 Sp32

Sp32

    CC Regular

  • Just Joined
  • PipPipPip
  • 26 posts

Posted 09 January 2011 - 01:02 PM

Thanks a lot Sam_Coder, you're awesome! It's working to key now. I feel all warm and fuzzy inside.
  • 0

#22 sam_coder

sam_coder

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 380 posts

Posted 09 January 2011 - 01:03 PM

LOL, Any time!
  • 0

#23 CodyMoores

CodyMoores

    CC Lurker

  • New Member
  • Pip
  • 7 posts
  • Location:Carbonear, Newfoundland
  • Programming Language:C, Java, C++, Objective-C, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Visual Basic .NET, ActionScript
  • Learning:C, Java, C++, Objective-C, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Ruby, Transact-SQL, ActionScript, VBScript

Posted 05 August 2012 - 06:37 AM

Ohhhh nice xD That could be really useful! Thanks xD +1Rep
  • 0

#24 CodyMoores

CodyMoores

    CC Lurker

  • New Member
  • Pip
  • 7 posts
  • Location:Carbonear, Newfoundland
  • Programming Language:C, Java, C++, Objective-C, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Visual Basic .NET, ActionScript
  • Learning:C, Java, C++, Objective-C, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Ruby, Transact-SQL, ActionScript, VBScript

Posted 05 August 2012 - 11:52 AM

I get errors ):


  • 0





Also tagged with one or more of these keywords: timer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download