Progress Bar in VB6
#1
Scooby Regular
Thread Starter
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes
on
0 Posts
Hi All,
I am trying to combine a progress bar with a timer in VB6 so it shows a visual indication of time left.
Have come up with this so far - but still have a problem as it will not accept the .value Any help please? (new to vb)
Dim Min As Integer
Dim Max As Integer
Dim Value As Integer
Private Sub Form1_Load()
Timer1.Interval = 1000
With SWBProgress1
Min = 0
Max = 10
Value = 0
End With
End Sub
Private Sub Timer1_Timer()
If SWBProgress1.Value = 10 Then
Unload Me
Else
SWBProgress1.Value = SWBProgress1.Value + 1
End If
End Sub
End Sub
Cheers
Big Daz
I am trying to combine a progress bar with a timer in VB6 so it shows a visual indication of time left.
Have come up with this so far - but still have a problem as it will not accept the .value Any help please? (new to vb)
Dim Min As Integer
Dim Max As Integer
Dim Value As Integer
Private Sub Form1_Load()
Timer1.Interval = 1000
With SWBProgress1
Min = 0
Max = 10
Value = 0
End With
End Sub
Private Sub Timer1_Timer()
If SWBProgress1.Value = 10 Then
Unload Me
Else
SWBProgress1.Value = SWBProgress1.Value + 1
End If
End Sub
End Sub
Cheers
Big Daz
#3
try this
Private Sub Form_Load()
Timer1.Interval = 1000
With ProgressBar1
.Min = 0
.Max = 5
.Value = 0
End With
End Sub
Private Sub Timer1_Timer()
If ProgressBar1.Value = 5 Then
Unload Me
Else
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Sub
This uses the progress bar to determine that 5 seconds have elapsed and updates the bar every second.
Private Sub Form_Load()
Timer1.Interval = 1000
With ProgressBar1
.Min = 0
.Max = 5
.Value = 0
End With
End Sub
Private Sub Timer1_Timer()
If ProgressBar1.Value = 5 Then
Unload Me
Else
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Sub
This uses the progress bar to determine that 5 seconds have elapsed and updates the bar every second.
#4
Scooby Regular
Thread Starter
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes
on
0 Posts
Tried the prog above (& removed the extra "end Sub")
The error is:
Compile Error
Method or data member not found
It highlights the .value part of the line:
If SWBProgress1.Value = 5 then
Any more thoughts please ?
Big Daz
The error is:
Compile Error
Method or data member not found
It highlights the .value part of the line:
If SWBProgress1.Value = 5 then
Any more thoughts please ?
Big Daz
#6
Scooby Regular
Thread Starter
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes
on
0 Posts
Private Sub Form1_Load()
Timer1.Interval = 1000
With SWBProgress1
.Min = 0
.Max = 10
.Value = 0
End With
End Sub
Private Sub Timer1_Timer()
If SWBProgress1.Value = 10 Then
Unload Me
Else
SWBProgress1.Value = SWBProgress1.Value + 1
End If
End Sub
Ok this seems to run with no errors but its not doing anything ie. not stopping after 10 secs and the progress bar does not move ?
Timer1.Interval = 1000
With SWBProgress1
.Min = 0
.Max = 10
.Value = 0
End With
End Sub
Private Sub Timer1_Timer()
If SWBProgress1.Value = 10 Then
Unload Me
Else
SWBProgress1.Value = SWBProgress1.Value + 1
End If
End Sub
Ok this seems to run with no errors but its not doing anything ie. not stopping after 10 secs and the progress bar does not move ?
Trending Topics
#8
Scooby Regular
Thread Starter
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes
on
0 Posts
Yep,
Timer Control set to "true"
Anyone I can email this to, to see if it will run for them pleeeese ?
I,m new to all this and its the second last piece I need to finish the project.
Cheers
Big Daz
Timer Control set to "true"
Anyone I can email this to, to see if it will run for them pleeeese ?
I,m new to all this and its the second last piece I need to finish the project.
Cheers
Big Daz
#9
Spotted the problem, change:
Private Sub Form1_Load()
to:
Private Sub Form_Load()
When the application is started the initialisation code is not being executed so there is nothing configuring the timer or the progress bar.
Cheers
Nigel
Private Sub Form1_Load()
to:
Private Sub Form_Load()
When the application is started the initialisation code is not being executed so there is nothing configuring the timer or the progress bar.
Cheers
Nigel
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
bar, basic, compile, data, datamember, error, found, member, method, progress, progressbar, progressbar1value, progressbarvalue, vb, vb6, visual