Results 1 to 10 of 10

Thread: [RESOLVED] Progress bar with timer?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    348

    Resolved [RESOLVED] Progress bar with timer?

    How do i make a progress keep moving to 100% with a timer liek every 10 seconds?

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Progress bar with timer?

    What is the total time?

    EG. Do you want the progress bar to progress at a 10 second rate, up till 60 seconds?

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Progress bar with timer?

    EG:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  
    5.     'Set up
    6.     ProgressBar1.Min = 0
    7.     ProgressBar1.Max = 10
    8.     ProgressBar1.Value = 0
    9.  
    10.     Timer1.Interval = 1000  '1 second
    11.     Timer1.Enabled = True
    12.    
    13. End Sub
    14.  
    15. Private Sub Timer1_Timer()
    16.     If ProgressBar1.Value >= 10 Then
    17.         'When max is reached, disable Timer
    18.         Timer1.Enabled = False
    19.     Else
    20.         ProgressBar1.Value = ProgressBar1.Value + 1
    21.     End If
    22. End Sub

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    348

    Re: Progress bar with timer?

    I tryed to let it run with a vbyesno msgbox but it closes wether i click yes or no.

  5. #5
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Progress bar with timer?

    Post your code.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    348

    Re: Progress bar with timer?

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. MsgBox " Would you like to install MasterControl", _
    5. vbYesNo, "MasterControl"
    6. If vbYes Then
    7.  
    8.     ProgressBar1.Min = 0
    9.     ProgressBar1.Max = 20
    10.     ProgressBar1.Value = 0
    11.  
    12.     Timer1.Interval = 1000
    13.     Timer1.Enabled = True
    14. End If
    15. If vbNo Then
    16. End
    17. End If
    18.  
    19. End Sub
    20.  
    21. Private Sub Timer1_Timer()
    22.     If ProgressBar1.Value >= 20 Then
    23.        
    24.         Timer1.Enabled = False
    25.     Else
    26.         ProgressBar1.Value = ProgressBar1.Value + 1
    27.     End If
    28. End Sub

  7. #7
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Progress bar with timer?

    Like:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  
    5.     If MsgBox("Would you like to install MasterControl", vbYesNo  [b]+ vbQuestion[/b], "MasterControl") = vbYes Then
    6.         ProgressBar1.Min = 0
    7.         ProgressBar1.Max = 20
    8.         ProgressBar1.Value = 0
    9.    
    10.         Timer1.Interval = 1000
    11.         Timer1.Enabled = True
    12.     Else
    13.         ProgressBar1.Visible = False
    14.     End If
    15.  
    16. End Sub
    17.  
    18. Private Sub Timer1_Timer()
    19.     If ProgressBar1.Value >= 20 Then
    20.         Timer1.Enabled = False
    21.     Else
    22.         ProgressBar1.Value = ProgressBar1.Value + 1
    23.     End If
    24. End Sub

  8. #8
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Progress bar with timer?

    VB Code:
    1. Private Sub Form_Load()
    2. if MsgBox(" Would you like to install MasterControl", _
    3. vbYesNo, "MasterControl") = vbYes Then
    4.  
    5.     ProgressBar1.Min = 0
    6.     ProgressBar1.Max = 20
    7.     ProgressBar1.Value = 0
    8.  
    9.     Timer1.Interval = 1000
    10.     Timer1.Enabled = True
    11. Else ' vbNo
    12. Unload Me
    13. 'DO NOT USE E ND
    14. End If
    15. End Sub

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    348

    Re: Progress bar with timer?

    thanks braille i guess i was posting whenever you do it works fine.
    Last edited by xypherx; Jan 2nd, 2007 at 09:35 PM.

  10. #10
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Progress bar with timer?

    Using Unload Me as BrailleSchool mentioned:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  
    5.     If MsgBox("Would you like to install MasterControl", vbYesNo  + vbQuestion, "MasterControl") = vbYes Then
    6.         ProgressBar1.Min = 0
    7.         ProgressBar1.Max = 20
    8.         ProgressBar1.Value = 0
    9.    
    10.         Timer1.Interval = 1000
    11.         Timer1.Enabled = True
    12.     Else
    13.         Unload Me
    14.     End If
    15.  
    16. End Sub
    17.  
    18. Private Sub Timer1_Timer()
    19.     If ProgressBar1.Value >= 20 Then
    20.         Timer1.Enabled = False
    21.         Unload Me
    22.     Else
    23.         ProgressBar1.Value = ProgressBar1.Value + 1
    24.     End If
    25. End Sub
    Last edited by Bruce Fox; Jan 2nd, 2007 at 09:39 PM.

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