Results 1 to 4 of 4

Thread: Timed Splash Screen

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    32

    Timed Splash Screen

    is there a way to make the splash screen show for just a few seconds then have it automatically dissappear instead of waiting for a keypress or click......

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Something like:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.    'Start timer
    5.    Timer1.Interval = 2000    '2 Seconds
    6.    Timer1.Enabled = True
    7. End Sub
    8.  
    9. Private Sub Timer1_Timer()
    10.    'Disable the timer and show Form2
    11.    Timer1.Enabled = False
    12.    Unload Form1
    13.    Form2.Show
    14. End Sub
    15.  
    16. Private Sub Form_dblClick()
    17. 'Gives the user a method to close off the Form1 (SplashScreen)
    18.    Unload Form1
    19.    Form2.Show
    20. End Sub


    Edited.......
    Last edited by Bruce Fox; Sep 20th, 2002 at 07:48 AM.

  3. #3
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    Or something like
    VB Code:
    1. ' In a module...
    2. Option Explicit
    3.  
    4. Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    5.  
    6. Sub Main()
    7.     frmSplash.Show
    8.     frmSplash.Refresh
    9.     Sleep (1000) ' Sleep for 1 second.
    10.     Load frmMain
    11.     Unload frmSplash
    12.     frmMain.Show
    13. End Sub

  4. #4
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    This will work place a timer on your form

    VB Code:
    1. Private Sub Form_Load()
    2.    'Start timer and give it interval which is five seconds
    3.  Timer1.Interval = 5000    
    4.  Timer1.Enabled = True
    5. End Sub
    6.  
    7. Private Sub Timer1_Timer()
    8.    Form2.Show
    9.    Unload Form1
    10.    'Disable the timer and show Form2
    11.    Timer1.Enabled = False
    12. End Sub

    Bruce Fox the code is good except you should always place
    VB Code:
    1. Tmer1.Enabled= False
    after you place the statements you want it to execute so that code for the timer should be on the last line of timer1 declaration
    Walter Richardson
    Striver2000 Christian Productions
    Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width