troubleshooting Question

Timers & Progress Bars

Avatar of fuzzyjon79
fuzzyjon79 asked on
Visual Basic.NET
2 Comments1 Solution288 ViewsLast Modified:
  I am writing a simple application with three progress bars...(I have added a timer to my form also) ProgressBar1 counts tenths of a second... ProgressBar2 counts seconds... and ProgressBar3 counts minutes... or at least that's what I want it to do... I want ProgressBar1 to show 10 blocks representing 10ths of a second.. and once that reaches 10/10ths... i want to increment the ProgressBar2 by one second and keep going until 60 seconds is reached.. then increment the minutes ProgressBar3 by 1 minute and so on and so forth.... Once 60 minutes is reached... I want to clear all the ProgressBars and start over.. Here is what I have so far... I've ran into a stumbling block because it doesn't work right... Any help is appreciated... Thanks!

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ProgressBar1.Value = 100
        ProgressBar2.Value = 0
        ProgressBar3.Value = 0

        Me.Timer1.Interval = 1
        Me.Timer1.Enabled = True
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value > 0 Then
            ProgressBar1.Value -= 1
        End If
        If ProgressBar1.Value = 1000 Then
            ProgressBar2.Value += 1
        End If

        If ProgressBar2.Value = 100 Then
            ProgressBar3.Value += 1

            Me.Timer1.Enabled = False
        End If

    End Sub
End Class
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros