I am new to programming (2 weeks of playing with it) I have written code for a t
ID: 3791589 • Letter: I
Question
I am new to programming (2 weeks of playing with it) I have written code for a timer in Visual Studio 2013. I am wondering if someone can show me how to write code/what the code would look like in a MODULE1.vb. I was thinking that for this timer I could create MsgBox using a DO UNTIL LOOP that would pop up every 20 seconds that says "hurry up!" until 1 minute has passed. As I said I am just starting to learn so please be very basic with me. Thanks.
This is the timer code I have and the time is fully functioning at this point:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Public Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
TextBox1.Text = Val(TextBox1.Text) + 1
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Application.Restart()
End Sub
Private Sub ClockToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ClockToolStripMenuItem.Click
ClockOutput.Text = TimeString
ClockOutput.Text = Format(Now, "hh:mm:ss tt")
End Sub
Private Sub DateToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateToolStripMenuItem.Click
DateOutput.Text = DateString
Dim today As Date = Date.Today
DateOutput.Text = DateTime.Now.ToLongDateString()
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub DateOutput_Click(sender As Object, e As EventArgs) Handles DateOutput.Click
End Sub
End Class
Explanation / Answer
As I can your code will generate a timer having basic function and a caender. Additionally you want to create a message box giving warning using do....until loop. As you are beginner, Don't worry!! I will explain you each and every steps od code.
So first of all you have to understand do...until loop
syntax:
The a Do...Loop structure is used when we want to repeat a set of statements an indefinite number of times, until a condition is satisfied.
We can use Until to specify condition.
So bellow is the code, you can append this;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.