Results 1 to 3 of 3

Thread: [RESOLVED] timer code improvement....

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Resolved [RESOLVED] timer code improvement....

    I haven't used a timer in a while and would like to know if this is the best way to go about using one. I have the timer enabled in the form load event of the form (used as a splash screen) as follows:
    VB Code:
    1. tmrSplash.Enabled = True
    and then the code for the timer is:
    VB Code:
    1. Private Sub tmrSplash_Timer()
    2. 10        On Error GoTo tmrSplash_Timer_Err
    3.          
    4. 20        If tmrSplash.Interval = 10000 Then
    5. 30            frmBRL.Show
    6. 40            tmrSplash.Interval = 0
    7. 50            tmrSplash.Enabled = False
    8. 60            Unload Me
    9. 70        End If
    10.          
    11. 80        Exit Sub
    12.          
    13. tmrSplash_Timer_Err:
    14. 90        WriteToErrorLog "BRLTimer"
    15. End Sub

  2. #2
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Melbourne, Australia
    Posts
    415

    Re: timer code improvement....

    I'm not sure what you mean, is frmBRL the main application?
    Do you want to to show the main app 10,000ms after the splash screen loads?
    If so, then use
    VB Code:
    1. Private Sub tmrSplash_Timer()
    2. 10        On Error GoTo tmrSplash_Timer_Err
    3.          
    4. 20        frmBRL.Show
    5. 30        tmrSplash.Enabled = False
    6. 40        Unload Me
    7.  
    8. 50        Exit Sub
    9.          
    10. tmrSplash_Timer_Err:
    11. 60        WriteToErrorLog "BRLTimer"
    12. End Sub
    and use
    VB Code:
    1. tmrSplash.interval = 10000
    2. tmrsplash.enabled = true
    To initialize the timer
    Last edited by Rob123; Apr 17th, 2006 at 12:34 PM.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: timer code improvement....

    to answer your question, yes, frmBRL is the main form of the app.

    Quote Originally Posted by Rob123
    I'm not sure what you mean, is frmBRL the main application?
    Do you want to to show the main app 10,000ms after the splash screen loads?
    If so, then use
    VB Code:
    1. Private Sub tmrSplash_Timer()
    2. 10        On Error GoTo tmrSplash_Timer_Err
    3.          
    4. 20        frmBRL.Show
    5. 30        tmrSplash.Enabled = False
    6. 40        Unload Me
    7.  
    8. 50        Exit Sub
    9.          
    10. tmrSplash_Timer_Err:
    11. 60        WriteToErrorLog "BRLTimer"
    12. End Sub
    and use
    VB Code:
    1. tmrSplash.interval = 10000
    2. tmrsplash.enabled = true
    To initialize the timer

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