Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,165 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,503 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Creation of Simple Splash Screen - VB2005

 
Reply to this topicStart new topic

> Creation of Simple Splash Screen - VB2005

Dilerious
Group Icon



post 22 Jan, 2006 - 11:48 AM
Post #1


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.
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

Virtual
*



post 10 Mar, 2006 - 11:58 AM
Post #2
Ripped??
http://www.extreme-tutorials.com/index.php?showtopic=447

check this! Exactly the same tutorial?
Go to the top of the page
+Quote Post

raulcabotage
*



post 3 Jun, 2006 - 10:46 PM
Post #3
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?
Go to the top of the page
+Quote Post

dibblm
*



post 11 Oct, 2007 - 05:45 AM
Post #4
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..
Go to the top of the page
+Quote Post

cyber_pirate
*



post 27 Jul, 2008 - 11:45 PM
Post #5
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 post has been edited by cyber_pirate: 27 Jul, 2008 - 11:46 PM
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 10/6/08 11:18AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month