This is what i have so far.

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        Timer2.Start()
        Button7.Enabled = True
        Label8.Text = "Match Begins"
    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        ProgressBar1.Increment(1)
        If ProgressBar1.Value = 3 Then
            Label8.Text = "1st Half"
        End If
        ProgressBar1.Increment(1)
        If ProgressBar1.Value = 100 Then
            Label8.Text = "Half-Time"
        End If

The code is to simulate the first half of a football match which lasts 45 minutes. I click the button7 to start the progress bar, and then my label says 'Match Begins'

At value 3 (of what i would like to be 1 minute) makes the label change again to '1st Half'. When the 45 minutes is up the label changes once again to read 'Half-Time'

I have managed to do all the labels correctly, but the progress bar itself doesn't know how long to run for. I have googled but struggled to find other people looking for minutes.

Recommended Answers

All 9 Replies

    Private Sub Button7_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button7.Click
        'set your timer to minutes
        Timer2.Interval = 60000
        'set you progressbar max value to 45
        ProgressBar1.Maximum = 45
        Timer2.Start()
        Button7.Enabled = True
        Label8.Text = "Match Begins"
    End Sub

    Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer2.Tick
        ProgressBar1.Increment(1)
        If ProgressBar1.Value = 1 Then
            Label8.Text = "1st Half"
        End If
        If ProgressBar1.Value = 45 Then
            Label8.Text = "Half-Time"
        End If
    End Sub

That works well. Thanks.

Is there a way to smoothen the increment at all? I tried 0.5 but it just didn't work. Maybe there isn't a way, worth an ask though.

Use the animation speed.

I'm not familar with animations, is it changed in code or the designer?

both and change the style, i think "Continuous" is what you are looking for

Just tried that but doesn't seem to make a difference. I changed Marquee speed from 100 to 1000 and maximum to 1000 and 'style' to Continuous but it stays the same as before. I'm not sure how fast it needs to be, but just needs to be smooth.

the animation speed works when you set the style to Marquee.
i recommand that you put it on continuous and change the progressbar maximum value to let's say 90 and change the time interval to 3000 this will make the progressbar increases slower and smoother.
please mark question solved.

I understand what you're saying now. I think it's just a case of playing around with the settings etc; Thanks for your help.

you are welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.