Full Version: Creation of Simple Splash Screen - VB2005
Dream.In.Code > Programming Tutorials > Visual Basic Tutorials
Dilerious
NOTE: THIS IS A TUTORIAL FOR VISUAL STUDIO 2005!

Creating the Splash Screen Layout.

Start by creating a new ‘Windows Application’. Open the ‘Solution Explorer’ and delete “Form1.vb”. Click the ‘Add New Item’ button and add a ‘Splash Screen’ to your project.

This will add a splash screen template. This is good as it has no toolbar at the top so it will look more professional.

Delete everything on the splash screen template and set the background colour to white. Add some text/images to the splash screen to display your application name/copyright/version etc.

Go to the Toolbox and add a timer to your project. Set the timer to “Enabled = False” in the Properties window. Go to your code and in the FormLoad sub put this code:


CODE

Timer1.Enabled = True




Now go back to the design view and add a Progress Bar to the Splash screen.
Add a label under your progress bar and remember the name of it.
Then paste this into your code replacing “Label2” with the name of your label underneath your progress bar.


CODE

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If ProgressBar1.Value <> ProgressBar1.Maximum Then
ProgressBar1.Value = (ProgressBar1.Value + 1)
Label2.Text = "Loading " & ProgressBar1.Value & "% Complete"
End If

End Sub




This code will make the progress bar work. The timer will add a value of 1 at every interval it is set to. You can leave it like this, but it doesn’t look much like a normal progress bar. To make it real, we’ll change the timer interval, thus changing the speed of the progress bar, at regular intervals. This will make it look a bit more random and like a real progress bar.

To add these random speed changes we need to edit the code I posted above. If you want to leave your progress bar at a constant speed then please ignore the next code snippets.

Add sections of code like this one after the “End If” statement but before the “End Sub” statement. You want these code snippets to be in the “Timer1.Tick” sub:


CODE

If ProgressBar1.Value = 1 Then
Timer1.Interval = 800
End If




The Value of the progress bar is the percentage it is at. The timer interval is the speed the progress bar would fill up at. To make it fill faster when it reached, lets say, 12%. Add this code:


CODE

If ProgressBar1.Value = 12 Then
Timer1.Interval = 200
End If




Lowering the timer interval will make it go faster. Keep adding more of these sections one after another to make your progress bar random. These are the first 5 of my progress bar timer:


CODE

If ProgressBar1.Value = 1 Then
Timer1.Interval = 800
End If

If ProgressBar1.Value = 2 Then
Timer1.Interval = 75
End If

If ProgressBar1.Value = 12 Then
Timer1.Interval = 600
End If

If ProgressBar1.Value = 14 Then
Timer1.Interval = 4000
End If

If ProgressBar1.Value = 15 Then
Timer1.Interval = 1
End If




At the end of all that, When the loading is completed, You can either add a button which will open the main form, or it can do it automatically. If you wish to add a button, please follow the instructions below. If you wish to make your program do it automatically please jump to ***

If you want to add a button, Place a button on your splash screen and set it to be not visible. Call it “cmdBegin”. Add this code to the Timer1.Tick Sub (Underneath all the interval changes):


CODE

If ProgressBar1.Value = 100 Then
Label2.Text = "Loading Complete"
cmdBegin.Visible = True
Timer1.Enabled = False
End If




This will change the label underneath the progress bar, will make the begin button visible and will turn the timer off.

Add a new form as the main window and call it FrmMain.

Double click the ‘begin’ button in design view and add this code to the sub it creates for you:


CODE

Private Sub cmdBegin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBegin.Click
FrmMain.Visible = True
Me.Visible = False
End Sub




This will show the main window and hide the splash screen.

***
Create a new form and call it FrmMain. Add this code to the end of the Timer1.Tick sub.


CODE

If ProgressBar1.Value = 100 Then
FrmMain.Visible = True
Me.Visible = False
End If




This will hide the splash screen and display the main window as soon as the progress bar reaches 100%


Add your main program content and decorate the splash screen with the colour scheme of the program.
Virtual
Ripped??
http://www.extreme-tutorials.com/index.php?showtopic=447

check this! Exactly the same tutorial?
raulcabotage
very nice topic,

i have just a couple of concerns, actually not related to the topic.

i wish to "push" text messages to mobile phones, should I create my own SMS Gateway and host it, or avail a commercial one. My project just requires plain "pushing" of text messages, or alerts with the user triggering this alert. It should be on schedule alert text message.

please tell me how to do this.

anyone?
dibblm
Being a newbie here. Looking for basic how to coding samples. This one so far was the best example I have found so far.

I really would like to see more coding samples laid out in this fashion for beginners like myself.

Kudus guys. Well done..
cyber_pirate
I'm a newbie member of dreamincode and so far this is the first topic that i can fully understand..I am hoping that you will pose more tutorial for newbies like me..thanks a lot,now i can start doing my splash screen!!

I use VB 6 but i hope it works..I tried Visual studio 2005 on school..
if you have a cracked version of visual studio 2005 please mail me..it's man_of_sleep@yahoo.com.ph..or perhaps add me as your friend for online discussion..thanks a lot..=)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.