Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activating a splash screen form 1

Status
Not open for further replies.

jimmyclams

Programmer
Nov 16, 1999
6
US
Thanks to everyone for responding to my previous question, I think this forum is great and of a lot of value. I am a novice, and there are just some things I can't find I my VB books or in Help files.<br>
<br>
In any case my question is how do I go about activating a splash screen. I have the form built, but when I run it it does not show up. When I do get it to show by typing Form1.Show - it shows up then stays up there, not appearing then disappearing at the start of a run like it should. So that is obviously not the solution. Can anyone help me with this, I have been trying to get it to work with a timer, but can't!
 
You can choose the form with which the application starts by choosing its name under project.. properties.. general... startup object. Choose the name of the splash screen form here. In the form load event of this form you can load your main form
 
jimmyclams<br>
<br>
Another way of doing this is to create a Sub Main procedure in a general module attached to your project. In it you may show the splash screen (FromName.Show) and while it is being displayed you can do other operations like opening a database or something you would like to do before showing the main form of your project. After your background processing you may hide or unload the splash screen (either FormName.Hide or UnLoad FormName) and then show the main form - MDIForm.Show or WhatEverFormName.Show.<br>
<br>
To activate the Sub Main procedure at startup you change the startup Object in the Project, ProjectName Properties SubMenu and for startup Object, replace the FormName with Sub Main.<br>
<br>
I hope this idea is useful.
 
Thanks for the response guys. Peekay, I tried your solution. The splash form only goes away if the user clicks it or presses a key, which is great. Hope I'm not being too picky but I've seen others where they go away after a certain amount of time. Are the programs doing things before hiding the splash forms like Liberty wrote? I don't really have any background processing to enable that, so I was wondering if it is worth it to program a &quot;timed&quot; splash screen or if it is acceptable programming practice to have a splash screen that goes away when the user clicks it.<br>
<br>
Thanks, <br>
<br>
jimmyclams
 
<br>
It has been a while, so you may already be on to bigger and better things. If not, I think this might do what you want. <br>
I don't know if the timer control is available on all versions. <br>
<br>
Assumes 2 forms, form1 and form2.<br>
Form1 is the “splash” form. Place a timer on it with the code shown below. (timer is invisible at run time)<br>
<br>
Form2 would be the main processing form. <br>
Be sure to adjust the project properties so that &quot;sub main&quot; is the startup object.<br>
<br>
‘module module1--------------------------------------------<br>
Option Explicit<br>
<br>
Private Sub main()<br>
Form1.Timer1.Interval = 2000 'in milliseconds<br>
Form1.Timer1.Enabled = True<br>
Form1.Show<br>
End Sub<br>
<br>
‘ form1---------------------------------------------------<br>
Option Explicit<br>
<br>
Private Sub Timer1_Timer()<br>
Timer1.Enabled = False<br>
Unload Form1<br>
Form2.Show ‘form2 holds your main processing.<br>
End Sub<br>
<br>

 
Use Refresh method after Show:<br>
<br>
frmSplash.Show<br>
frmSplash.Refresh<br>
Load frmMain<br>
Unload frmSplash<br>
frmMain.Show<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top