Some help on progress bar!

Navi
09-10-2003, 07:54 AM
I am trying to make a progress bar which is filled up after 4 seconds then goes away... what am i doing wrong?


it gives an error now, Invalid Property Value and it points to "proBar1.Value = proBar1.Max - timeloop"



help appreciated




Private Sub Form_Load()
' Progress Bar specifications
proBar1.Min = 0 ' Set minimum value
proBar1.Max = 100 ' Set maximum value
proBar1.Value = 0

'Timer settings for progress bar
Timer1.Enabled = True
Timer1.Interval = 1000 ' 1 second

' set timeloop
Dim timeloop
timeloop = 100
End Sub

Private Sub Timer1_Timer()

timeloop = timeloop - 25
proBar1.Value = proBar1.Max - timeloop

If timeloop = 0 Then
Unload Me
End If

End Sub

reboot
09-10-2003, 07:57 AM
If you'll put Option Explicit in the General Declarations section of your Form (the very top of the code), the compiler will immediately inform you of one problem you have...

Navi
09-10-2003, 07:59 AM
when i do it said Variable nor defined "timeloop"

so i did dim timeloop

and now it still does same error, HELP!

reboot
09-10-2003, 08:02 AM
You need to go learn about 'scope' (not the mouthwash)
Option Explicit

Dim Timeloop As Long

Private Sub Form_Load()
' Progress Bar specifications
proBar1.Min = 0 ' Set minimum value
proBar1.Max = 100 ' Set maximum value
proBar1.Value = 0

'Timer settings for progress bar
Timer1.Enabled = True
Timer1.Interval = 1000 ' 1 second

' set timeloop
Timeloop = 100
End Sub

Private Sub Timer1_Timer()

timeloop = timeloop - 25
proBar1.Value = proBar1.Max - timeloop

If timeloop = 0 Then
Unload Me
End If

End Sub

techmanbd
09-10-2003, 08:06 AM
I would also put the timeloop = 100 and the timer1.interval = 1000 before you do timer1.enable = true. Because the way it is now, the timer starts before the code gets to the other 2 settings

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum