Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Progress Bar in VB6

Thread Tools
 
Search this Thread
 
Old 03 January 2004, 03:37 PM
  #1  
Big Daz
Scooby Regular
Thread Starter
 
Big Daz's Avatar
 
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes on 0 Posts
Angry

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
Old 03 January 2004, 03:53 PM
  #2  
SiDHEaD
Scooby Regular
 
SiDHEaD's Avatar
 
Join Date: Apr 2002
Location: Birmingham
Posts: 9,196
Likes: 0
Received 0 Likes on 0 Posts
Post

Which bit does it break on? what error code?

Why've you got 2 "End Sub"s at the end?

Andy
Old 03 January 2004, 03:54 PM
  #3  
Nicks VR4
Scooby Regular
 
Nicks VR4's Avatar
 
Join Date: May 2003
Posts: 1,165
Likes: 0
Received 0 Likes on 0 Posts
Post

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.

Old 03 January 2004, 05:06 PM
  #4  
Big Daz
Scooby Regular
Thread Starter
 
Big Daz's Avatar
 
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes on 0 Posts
Unhappy

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
Old 03 January 2004, 05:20 PM
  #5  
Nicks VR4
Scooby Regular
 
Nicks VR4's Avatar
 
Join Date: May 2003
Posts: 1,165
Likes: 0
Received 0 Likes on 0 Posts
Post

It highlights the .value part of the line:
If SWBProgress1.Value = 5 then
------------------------------

Try changing this to = 10
Old 03 January 2004, 05:34 PM
  #6  
Big Daz
Scooby Regular
Thread Starter
 
Big Daz's Avatar
 
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes on 0 Posts
Post

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 ?
Old 03 January 2004, 05:52 PM
  #7  
nigelward
Scooby Regular
 
nigelward's Avatar
 
Join Date: Oct 2001
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Post

Is the Timer control enabled?

Trending Topics

Old 03 January 2004, 08:20 PM
  #8  
Big Daz
Scooby Regular
Thread Starter
 
Big Daz's Avatar
 
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes on 0 Posts
Exclamation

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
Old 03 January 2004, 11:31 PM
  #9  
nigelward
Scooby Regular
 
nigelward's Avatar
 
Join Date: Oct 2001
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

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
Old 05 January 2004, 07:51 AM
  #10  
Big Daz
Scooby Regular
Thread Starter
 
Big Daz's Avatar
 
Join Date: Nov 2002
Location: Bonnie Scotland
Posts: 784
Likes: 0
Received 0 Likes on 0 Posts
Talking

Managed to get it running using a slightly different method,
Cheers for all the assistance

Big Daz
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Abx
Subaru
22
09 January 2016 05:42 PM
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
FuZzBoM
Wheels, Tyres & Brakes
16
04 October 2015 09:49 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM



Quick Reply: Progress Bar in VB6



All times are GMT +1. The time now is 02:04 AM.