Results 1 to 3 of 3

Thread: Counter (VB6)

  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Counter (VB6)

    I want to add a hidden text on a form which will count the number of seconds whilst loading numerous images.
    The timer will have to stop once all images have been loaded.

    Once I have this value, I can use the hidden value as a marker for a progress bar control.

    How do I do this ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Counter (VB6)

    You can put a Timer control on your form. Set its Interval property to the update frequency in milliseconds; for example if you wish to update every second, use 1000. Ise it like this:

    - Declare a variable of type Single at the top of the form module:

    Private sngTime As Single

    - Set sngTime to the value of Timer (this is a built-in function, not the control) and set the Interval property of the Timer control before starting the loading of images:

    sngTime = Timer
    Me.Timer1.Interval = 1000

    - Double click the Timer control to create an On Timer event handler:

    Private Sub Timer1_Timer()
    Me.txtSeconds = Timer - sngTime
    End Sub

    - Set the Interval property to 0 to turn off the timer when you're done:

    Me.Timer1.Interval = 0

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counter (VB6)

    Thankyou Hans

    That should get me on my way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •