Introduction:
When developing heavy program under any platform you will notice that the program requires a lot of time to start. So what the programmers are doing is that they introduce a screen just before displaying the Main Form which indicates you have started the program and it is loading. So to have modern look and to indicate the user that the program is being loaded we must include Splash Screen in our programs. Designing the Splash Screen is an easy task and requires very little skill.
Designing a Splash Screens
Generally a Splash Screen includes Image/Logo that resembles your program. The Splash Screen is generally displayed on the centre of the Screen. So when you have started designing the Splash Screen. Set the properties of the Splash Screen Form as given below
frmSplashScreen.frm
Properties:
·StartUpPosition: 2 – Centre Screen
·BorderStyle: None
·ShowInTaskbar: False
Now to add a Image/Logo on the Splash Screen drag a Image Control on to the Screen. You may use a PictureBox to do the same. But the Stretching property will not be allowed in PictureBox. Here I used a Image Control and set the properties to…
Image
Properties:
·Picture: Put the path of your Logo/Image
·Stretch: True
Now add the label displaying the name of your program and your identity and assign the colors and fonts as your require. Now the main phase of designing the Splash Screen comes in.
As till now your designing part is completed. Now take the Timer Control and place it on your form. Place it anywhere on your form as it will not be displayed at run time. Decide the time for which you want the user to view your splash screen. If you will be adding a progress bar then close splash screen as soon as the entire program loading process is completed. Set the timer Interval to about 1000 seconds. At the Timer event (i.e Timer1_Timer) of your Timer add the following code which will unload the splash screen and then display the Main Form(Named as frmMain.frm).
Private Sub Timer1_Timer()
Unload Me ‘Unload the Splash Form
frmMain.Show ‘Load the Main Form
End Sub
Also don’t forget to set Splash Screen Form (frmSplashScreen.frm) as your startup form in your project properties. After you have done all with this run your program and watch the difference you get. In later section I will discuss how to add a progress bar effect on the SplashScreen. Do post comments and your designed screens.s
Jim Wilson said:
I am interested in how to put a progress bar up on a splash screen and how to let the splash screen know that the main form is finished loading.
Muhammad Aftab said:
it is really help full and easy to understand.
Geethal Fernando said:
It worked well.Thanks
However, in my application the work is done as part of loading the main form so I opened the splash and after one second opened the main form followed by i=unload me
This did the job
Private Sub Timer1_Timer()
frmMain.Show
Unload Me
End Sub
Now I woiuld like the code for progress bar effect on the SplashScreen
Shaili said:
Yes, it works..however I am interested in using a progress bar dynamically showing the status of progress!
Aditya said:
it’s superb….Thanx. I think microsoft should learn….how to put articles on websites…….
Mohammed Hussain said:
Of Great Help!…Thanxs. The way it was explained was superb.
Sandeep Jain said:
Thanks for appreciating my work….
Cody said:
Ok I use Visual Studio 2005. I’m not sure how to move the splash screen in the code but you can do it in the poperties box.
Rishipathak Yogesh said:
Thanks
The way of you coding is very nice.however I am interested in using a progress bar.howing the status of progress!
Abdulrahim Harunani said:
Hello
I am a student studing programming and would like to know how to animate buttons when a mouse is brought over it.
animatio like constant colour changing, changing the shape of the button e.t.c
please assist me as this is a project i am working on and am really stranded with such code.
thank you.
Sam said:
Very nice indeed,
I’m looking just like “Adult visuals” for a way to make the position of the splash screen relative as I don’t want it to be at the center of the monitor, settings things to “Manual” wouldn’t help much because if users have got different resolutions, the splash may not be visible at all 😦
Sam said:
OK, I think I found it,
More info: http://vbcity.com/forums/topic.asp?tid=3486
Lemar said:
Yow this Bazzel Thanx, I really appreciate it
nitin said:
its works …………….
thanks a lot………
Amit Rajput said:
How one can know the actual time the main form would take to load?And show the actual progress throught progress bar.
Leonardo Alberto said:
Very good and simple to understand. Thank you for explication.
James said:
Hi,
its working perfect. i was reading the article before but tried it now step by step and its great. thank you for the great guidance!
regards,
james
Manoj Varghese said:
Thanks it worked well. Will be very helpful if u can specifytutorial for VB to database communication that is taking data from database and sending data to database.
Nilesh B said:
Good work…..very easy to understant…Thank’s a lot
dhaval shah said:
i have spalsh screen created & in timer event i have put code:
splashscreen.hide
form1.show
timer event has set time to 1sec.
now the form1 is displayed in interval of every 1 second
what should i do??
Sandeep Jain said:
Please append the following code to your rimer code…
timer.enabled=false;
This line while disable the timer and thus your splash screen won’t show up again and again after every 1sec…
tc…
tarun said:
I need to know, what is the code for progress bar in Visual Basic 6.0?
LUCY said:
thankyou the code was helpful so lets see about the progress bar!!!
Proshanta said:
Very very helpful. pleas help for progress bar
Proshanta said:
very very helpful
Proshanta said:
very helpful
Athar Anis said:
very much helpful… when can i get the progress bar bit here???
Athar Anis said:
Ok.. I think i should carry forward the flag now.. as there are many people waiting for the progress bar set up. i know this is not one of the best code but at least does the job.
I will start by explaining where to find the progress bar from.
In the Vb6 IDE, click Project -> components. Now look for, Microsoft Windows Common Controls 6.0 (SP6). This should add the progress bar button in the General Tab.
Can you find it yet? If not then try looking for other Microsoft Windows Common Controls, for example Microsoft Windows Common Controls-2(SP6). Or (SP5)
Ahaann, I guess you have added it successfully…
Now, put it on the splash screen described by Sandeep (at the beginning of this blog)
I have added a LABEL on the form called label2. This label will let the user know about what is actually happening in the background. This gives a better feel.
Oh yeah, don’t forget to set the interval of the TIMER CONTROL to 1. I know it’s a short delay, but once you get to the code part of this blog, you will realize why I m doing that.
Next, I declared a variable ‘aa’, the value of which will be embedded in the progress bar’s meter. (Don’t get confused yet, I will explain it soon)
So in the code, declare a global variable
Public aa As Integer
And in the form_load event, I initialized the value of this variable.
Aa = 0
Now,
In the timer1_timer(), add the following code (Depending on the type of work you are doing)
Private Sub Timer1_Timer()
‘ To give the user a feel that the system is working now..
Screen.MousePointer = 13
‘Generate Random Numbers, so that every time you run this page, the progress bar ‘doesn’t process the same. That’s the reason, why timer control’s interval was set to 1.
aa = aa + (Math.Rnd(1000) Mod 5)
‘now set the progress bar’s value
progressbar1.Value = aa
‘Once the progress bar reaches half way, start to establish a connection with the database, ‘and while its been done, notify the user that an attempt is being made
If progressbar1.Value = 50 Then
Label2.Caption = “Establishing Database Connection…”
‘Here I am trying to open the database connection, CON is the connection string
‘declare it too. Public con As New ADODB.Connection
If con.State = 1 Then con.Close
‘Change these settings depending on your server configurations
con.Open “Driver={SQL Server};Server=fileserver\finos53;Database=asytm;Uid=myuser;Pwd=mypassword;Language=British”
ElseIf progressbar1.Value = 80 Then
Screen.MousePointer = 13
Label2.Caption = “Opening Application…”
ElseIf progressbar1.Value = 100 Then
mainform.Show
Unload Me
Screen.MousePointer = 0
End If
End Sub
YOU ARE DONE NOW… RUN IT… and hey… like I said, I know its not the best approach, but for the time being, and the User-level I assume you have, it’s a better off.
For more advance features, tips & tricks and troubleshooting, you can email me anytime on athar_anis@nrlpak.com.
Ross said:
why doesnt it show wen i run it. i did everything u said bt instead of shwoing the flash screen it just shows the main form 🙂
ARGH!
lol
Nitika Newar said:
hi! I m lecturer in the college it is very helpful for me to make the students understand about the Splash Screen!!!!
Thanks!!!
chris said:
how do i put splash screen? and progress bar?
Siddharth said:
Brilliant work. Nice explanation – This works so fabulously !!
George Rex (aka Rexyspy) said:
Nice work on the post about establishing the splash screen. Its just the right medicine needed fro programmers like us who are self-learners….
Thanks a million times.
angelica said:
..ei!i wanna make an animation in my splash screen..it would have been easy if the direction is just from left- right or up-down or vice versa..but then our teacher is requiring us to have the animation move in projectile motion..pls help..we’ll be doing this activity tomorrow..
and also i wanna ask on how to do simple encryption and decryption on a login form..gee!!im not really good in this field..(poor me)..and to the worst, our instructor doesn’t give enough infos for us to do the said tasks..pls help…
mafia said:
hey man it worked 4 me!!!!!!!!
thank u!!!!!!!
i was doing computer project n i wasnt able to animate the progress bar!!!!!!!
thnx again n again!!!!!!!!!!!
u deserve a TROPHY in VISUAL BASIC!!!!!!!!
by the way, where did u learn VISUAL BASIC ????????????
Manish Kumar said:
I want to know how to take a splash screen in the project.
lvmontiel said:
Spalsh Screen with ProgressBar.
Create a new project (Form1 as default) and then add a second Form
(Form2), rename with “frmSplash”.
In the Project Properties set Startup Object: frmSplash.
On frmSplash put 1 ProgressBar.
The Timer1 on the frmSplash, set: Enabled=True, Interval=100.
The ProgressBar1 on the frmSplash set: Max=100, Min=0.
The Label1 on the Form1 set: Caption=”Hello World..!”
Click on the Form to Exit.
‘—————————————————————
‘Code: Form1.frm
‘
Private Sub Form_Click()
Unload Me
End Sub
‘—————————————————————-
‘Code: frmSplash.frm
‘
Private Sub Timer1_Timer()
Static i As Integer
ProgressBar1.Value = Val(ProgressBar1.Value) + 10
If ProgressBar1.Value = 100 Then
Timer1.Enabled = False
Unload Me
Form1.Show
End If
End Sub
‘——————————————————————-
I’m a novice to this language (VB6).
Pingback: Splash Screen In Visual Basic 6.0 « Athar Anis's Blog
lata said:
thanx
it was so easy.
Alan xxx said:
worst feedback ever… SHIT!!!!!
aleh woody said:
thank you so much ..
very helpful 😀
Zekarias said:
It is wonder full ! And help full…….Thank you
RAKESH MISHRA,BARIATU ROAD ,RANCHI said:
THANKS FOR SO VALUABLE POST. IT IS EXACTLY I EXPECTED
.THANKS AGAIN
Chandraprakash said:
Hey Man, your guidance is ossum. But i don’t want to use any timer control for progressbar. as we all have seen, when any application is loaded, splash screen is seen. But when we run same application on low configuration computer, it will take more time to hide splash screen. that means they don’t have used any timer control. they may have used progress bar with the process of the computer. I wanna hide my splash screen not with the help of timer control, but by the ending of loading process which may differ from computer to computer. So, if you have any guidance about it, please send it to my mail address or post it here.
Chandraprakash said:
My email address is shahchandraprakash@ymail.com. Please repy me or send me how to connect the process of process bar with the computer’s loading process. For example, if you load MS OFFICE 07 in P4, it will take more time to hide splash screen while it will not take so much time in Core 2 Duo. That means splash screen has no relation with timer control, but it has something related to the process of the computer.
Pls. let me know who to connect the splash form with the process of computer.
top mistakes said:
Your blog is really cool to me and your topics are very relevant. I was browsing around and came across something you might find interesting. I was guilty of 3 of them with my sites. “99% of site owners are doing these 5 errors”. http://is.gd/MP2Ncf You will be suprised how easy they are to fix.
doleHesk said:
order an usDkHVaB [URL=http://prada1outlet2online.devhub.com/ – prada handbags outlet[/URL – to take huge discount qyQOzUkQ [URL=http://prada1outlet2online.devhub.com/ – http://prada1outlet2online.devhub.com/ [/URL –
paul said:
nice it was really helpful
yinka said:
my project was working fine until when I add splash screen to on it, the program start normal but when I click on another page/form it automatically go on back to the first form mn after splash screen. please what to do?
Kaunda said:
its working fine