Public Class frm_Main
    Private Sub btn_Start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Start.Click
    End Sub
    Private Sub btn_Stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Stop.Click
    End Sub
    Private Sub btn_Reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Reset.Click
        tbx_Min.Text = "10"
        tbx_Sec.Text = "00"
        tbx_MilSec.Text = "00"
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Do Until tbx_Min.Text = "00"
            Do Until tbx_Sec.Text = "00"
                Do Until tbx_MilSec.Text = "00"
                    Dim MilSec1 As Integer
                    MilSec1 = tbx_MilSec.Text
                    MilSec1 = MilSec1 - 1
                    tbx_MilSec.Text = MilSec1
                Dim Sec1 As Integer
                Sec1 = tbx_Sec.Text
                Sec1 = Sec1 - 1
                tbx_Sec.Text = Sec1
            Dim Min1 As Integer
            Min1 = tbx_Min.Text
            Min1 = Min1 - 1
            tbx_Min.Text = Min1
    End Sub
End Class

So far, this is my code. I am designing a Customizable Youtube Countdown Timer, and I am having some issues.
Whenever I start up the Form and press the "btn_Start" Button, the entire form freezes, and requires to be shutdown from Visual Basic Express 2010, where I am working, or through Task Manager.

Just in case... btn_ is my prefix for Buttons
tbx_ is my prefix for Textboxes

Please help me, because my friends and I currently need this form to work...

Recommended Answers

All 3 Replies

Your textbox is never going to equal "00". It will equal "0" however when it counts down (1 - 1 = 0, 1 - 1 != 00).
Also, at no point do you reset the seconds away from 00. E.g. 10.00.00 minus 1 sec doesn't seem to become 9.59.00 in your code.

Thank you for your reply hericles, but can you deliberate further into how I can fix this problem?

You need to provide starting values for the millisecond and second when the countdown starts annd then resent those values again once a loop is finished. Inside the seconds loop reset the millisecond control to 100 after decreasing the seconds by 1 (otherwise the next millisecond loop has nothing to do), then reset the seconds to 60 after decreasing the minutes by 1.
Change your loop final to check for "0" instead of "00" to test it. You can also add code in to display "00" but check for "0" later if you want the digital clock look.

Be a part of the DaniWeb community

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