I have a problem with this I do not know how to Choose the time it comes out as the program differently?
Public Class Form1 Dim Hours As Integer Dim Minutes As Integer Dim Seconds As Integer Dim Time As Date Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Timer1.Enabled = False If (Format$(Time, "hh") & ":" & Format$(Time, "nn") & ":" & Format$(Time, "ss")) <> "00:00:00" Then 'Counter to continue loop until 0 Time = DateAdd("s", -1, Time) Label1.Visible = False Label1.Text = Format$(Time, "hh") & ":" & Format$(Time, "nn") & ":" & Format$(Time, "ss") Label1.Visible = True Timer1.Enabled = True Else 'Turn off timer, set off alarm, and enable reset. Timer1.Enabled = False Beep() Beep() Button3.Enabled = True End If End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Mydisplay() End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged Mydisplay() End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged Mydisplay() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Set timer interval and varibles Timer1.Interval = 1000 Hours = 0 Minutes = 0 Seconds = 0 Time = 0 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Enabled = True End Sub Private Sub Mydisplay() 'This code is common to all three text boxes so I 'put it in it's own sub. 'Extract the numbers from the text boxes by using 'the Val() statement. Hours = Val(TextBox1.Text) Minutes = Val(TextBox2.Text) Seconds = Val(TextBox3.Text) 'Convert variables to time format Time = TimeSerial(Hours, Minutes, Seconds) 'Display the converted time variable in label 1 Label1.Text = Format$(Time, "hh") & ":" & Format$(Time, "nn") & ":" & Format$(Time, "ss") End Sub End Class
Last edited by a moderator: