Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want a splash screen for my program to make it look nice. So what I need is a code that will display it for like 3 seconds then open the main form.

 

Also, if I need to change anything, like the startup form or something please post that I do. Thanks.

  • Administrators
Posted

Agreed but he also gives firstly a good way to do splash screens and suggests that forcing a user to sit and stare at a splash screen may be a bad idea, a topic also discussed in the second thread I linked to.

Is there a requirement for the 3 second delay? If so you could just change VolteFace's code so instead of filling a listbox it just calls

threading.Thread.CurrentThread.Sleep(3000)

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
Yeh having to wait three seconds for a splash screen to load would force me to stop using that program and find another. What is widely accepted (and I'm sure that the articles linked to above will say the same thing), is that you should display it for 3 seconds UNLESS the user clicks or presses a key. If the user really wants to read this information, it should be in the About box, which is generally the same information anyway!
Posted

Well.. i guess you are right, It would be nice to have it when you press a key or click the mouse it would skip it.

 

Or maybe just make it like 2 seconds, i dunno.

Posted

to do what you want to do simply add this code to your forms Load event

 

Private Sub frmMain_Load(ByVal sender as object, ByVal e as eventargs)

Me.Visible = False
Dim aForm as new frmAbout()
aForm.ShowDialog()
Me.Visible = True


End Sub

'in the About form add this code so you don't piss your users off

Private Sub anything_Click(byval sender as object, e as eventargs) Handles Me.Click, lblInfo.Click, picLogo.Click
'sample control names are used
Me.Close()

End Sub

Dim _ticks as Integer = 0
Private Sub Timer1_Tick(byval sender as object, e as eventargs)

_ticks += 1
If _ticks = 3 Then
Me.Close()
End If
'Change the opacity little by little to make it fade away and
'look 'more professional
End Sub

 

I am creating a utility to make about forms effortless

I will be posting here when it is completed.

 

brandon

i'm not lazy i'm just resting before i get tired.
Posted

This is what I do for my splash screens, and it works every time. I think it's fairly simple and to the point.

 

'Insert a new module into your form (Project > Add Module...)
'Use this code for the module (Note that you must change your startup object to Sub Main()
Sub Main()
       Dim Splash As New frmSplash      'Where frmSplash is your splash screen form name
       Dim MainForm As New frmMain     'Where frmMain is your main program form name
       Splash.ShowDialog()
       MainForm.ShowDialog()
End Sub

'Now go to your splash screen and use this code (you must add a new Timer Object to your splash screen form
Private Sub frmSplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       SplashTimer.Interval = 3000        'Set timer interval to 3 seconds
       SplashTimer.Enabled = True        'Enable timer
End Sub
'Code for splash screen timer
   Private Sub SplashTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SplashTimer.Tick
       Me.Close()        'Close splash screen form, your main form will now load
   End Sub

 

Hope that helps. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...