8 Replies - 9337 Views - Last Post: 05 March 2010 - 02:10 PM Rate Topic: -----

#1 systemerror   User is offline

  • D.I.C Head

Reputation: -19
  • View blog
  • Posts: 205
  • Joined: 15-August 09

C# splash screen

Post icon  Posted 10 November 2009 - 10:10 PM

Im trying to make a splash screen in C# hers my code

		private void Form1_Load(object sender, EventArgs e)
		{
			Form2 Splash = new Form2();
			Splash.Show(); // show
			Thread.Sleep(3000); // sleep main thread for 3 seconds
			Splash.Close(); // close splash screen
		}


But it doesn't seem to come up, can anyone help?
Is This A Good Question/Topic? 0
  • +

Replies To: C# splash screen

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5308
  • View blog
  • Posts: 14,171
  • Joined: 18-April 07

Re: C# splash screen

Posted 10 November 2009 - 10:28 PM

Well there is nothing wrong with that code. Personally I wouldn't have used sleep to do it, but instead just use a timer control which would make this a bit nicer to work with. It would also allow things like controls on the splash form to still function etc (like loading a progress bar, drawing of buttons etc) which thread sleep will probably interfere with. Sleep will stop the thread dead in its tracks and prevent a lot of paint functionality of the new splash form. Could even be the reason why you are not seeing anything. However, you should at least see the window.

:)
Was This Post Helpful? 0
  • +
  • -

#3 systemerror   User is offline

  • D.I.C Head

Reputation: -19
  • View blog
  • Posts: 205
  • Joined: 15-August 09

Re: C# splash screen

Posted 11 November 2009 - 02:45 AM

View PostMartyr2, on 10 Nov, 2009 - 09:28 PM, said:

Well there is nothing wrong with that code. Personally I wouldn't have used sleep to do it, but instead just use a timer control which would make this a bit nicer to work with. It would also allow things like controls on the splash form to still function etc (like loading a progress bar, drawing of buttons etc) which thread sleep will probably interfere with. Sleep will stop the thread dead in its tracks and prevent a lot of paint functionality of the new splash form. Could even be the reason why you are not seeing anything. However, you should at least see the window.

:)


I tried this instead
		private void timer1_Tick(object sender, EventArgs e)
		{
			Form2 Splash = new Form2();
			Splash.Show(); // show
			Splash.Visible=false; // close splash screen

			if (Splash.Visible == false)
			{
				timer1.Stop();
			}
		}


But I can't make like a yes or no, answer thingy
Was This Post Helpful? 0
  • +
  • -

#4 systemerror   User is offline

  • D.I.C Head

Reputation: -19
  • View blog
  • Posts: 205
  • Joined: 15-August 09

Re: C# splash screen

Post icon  Posted 12 November 2009 - 11:59 PM

		private void timer1_Tick(object sender, EventArgs e)
		{
			Form2 Splash = new Form2();
			Splash.Show(); // show
			Splash.Visible=false; // close splash screen

			if (Splash.Visible == false)
			{
				timer1.Stop();
			}
		}


I did something like this and the splash screen wont come up, even if i just try to open the window like this
			Form2 Splash = new Form2();
			Splash.Show(); // show


can some one plz help?
Was This Post Helpful? 0
  • +
  • -

#5 paperclipmuffin   User is offline

  • Disassembling...
  • member icon

Reputation: 13
  • View blog
  • Posts: 944
  • Joined: 16-April 09

Re: C# splash screen

Posted 13 November 2009 - 12:32 AM

When you create a new form, root around and you will find "Splash Screen". Easier to use.

Good luck :)
Was This Post Helpful? 0
  • +
  • -

#6 systemerror   User is offline

  • D.I.C Head

Reputation: -19
  • View blog
  • Posts: 205
  • Joined: 15-August 09

Re: C# splash screen

Posted 13 November 2009 - 12:41 AM

View Postpaperclipmuffin, on 12 Nov, 2009 - 11:32 PM, said:

When you create a new form, root around and you will find "Splash Screen". Easier to use.

Good luck :)


I don't understand what you are saying
Was This Post Helpful? 0
  • +
  • -

#7 Grapevine   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 55
  • Joined: 26-October 09

Re: C# splash screen

Posted 13 November 2009 - 09:19 PM

This helped me. Maybe it will work for you?

http://www.codersour...ash_screen.aspx

Later
Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: C# splash screen

Posted 13 November 2009 - 10:01 PM

Topics merged, please do not create duplicate topics :)
Was This Post Helpful? 0
  • +
  • -

#9 Guest_Jose Lara*


Reputation:

Re: C# splash screen

Posted 05 March 2010 - 02:10 PM

View Postsystemerror, on 10 November 2009 - 09:10 PM, said:

Im trying to make a splash screen in C# hers my code

		private void Form1_Load(object sender, EventArgs e)
		{
			Form2 Splash = new Form2();
			Splash.Show(); // show
			Thread.Sleep(3000); // sleep main thread for 3 seconds
			Splash.Close(); // close splash screen
		}


But it doesn't seem to come up, can anyone help?


Hi,

The code is fine but make sure you are not missing the (using System.Threading) directive found
on the very top of your Form1.cs code it contains other using directive like the following.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;


Thanks,
Jose
Was This Post Helpful? 0

Page 1 of 1