loading
In this instructable I will show you how to make a simple timer in Visual Basic 2010

It has : 4 Buttons
             8 Labels
             3 Numeric Up Down
             1 Timer

Step 1: New Project

First Open Visual Basic and make a new project and select Windows Forms Application


<p>Its working good..</p>
<p>I have a problem.</p><p>I copied ALL and PASTED ALL, but Sec. are falling SO fast!!!!</p>
How come the minutes are negetive? <br>00 : -1 : 48 <br>and what's the use of numeric up down?
The numeric up down is for the user to set the desired hours, minutes, seconds. once he choses the desired time he presses the set button and then the start button to start counting down to 0. <br> <br>&quot;How come the minutes are negetive? <br>00 : -1 : 48 &quot; <br>you probably didn't set the time first and it just counted down from 0
<p>But...... My thing is to add Timer1.Enabled = false</p><p>OMG sonal2913 im beginner, this is SO SO SO easy!</p>
<p>Thanks JD that works really well. </p><p>Sam</p>
<p>I'm doing a project in Visual Studio 2013 is the pacman PictureBox need a code that moves by itself is the enemy and also need another code for the wall like the tego Labels will thank a lot</p>
<p>use timer. also X and Y possition = (integer for distance to move)</p><p>private sub tmr_tick(byval e as object).handles tmr_tick</p><p> 'picture of pacMan named PICPM</p><p> dim POS as integer = 5</p><p> PICPM.left = POS</p><p>end sub</p><p>theres the base code just manipulate it to get the results required</p>
Hello Rohit and sonal just use below code instead of given code in steps...it will work!! <br> <br> Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick <br>If label1.Text = &quot;00&quot; And label1.Text = &quot;00&quot; And label1.Text = &quot;00&quot; Then <br> Timer1.Enabled = False <br> End If <br> If label5.Text = 0 And label3.Text &lt;&gt; 0 Then <br> label5.Text = 59 <br> label3.Text = label3.Text - 1 <br> ElseIf label5.Text &gt; 0 Then <br> label5.Text = label5.Text - 1 <br> End If <br> If label3.Text = 0 And label1.Text &lt;&gt; 0 Then <br> label3.Text = 59 <br> label1.Text = label1.Text - 1 <br> End If <br>End sub <br> <br>I Hope it will usefull to you. <br>:-)
Dsnt Work i put numbers in those boxes and set and start nothing works and my timer1 enabled = false when i make it true i can nt do anything i did nothing it Starts with negative numbers 0:-1 :59
How come the minutes are negetive? <br>00 : -1 : 48 <br>and what's the use of numeric up down?
I think I figured it out!<br><br>With what I had, when the hour changed, it would make the minutes 59 and then go to 58 changing the seconds to 59 directly afterwards. I changed the value of Label5.Text = 60<br><br>So:<br><br>Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br> If Label5.Text = 0 Then<br> Label5.Text = 59<br> Label3.Text = Label3.Text - 1<br> ElseIf Label5.Text &gt; 0 Then<br> Label5.Text = Label5.Text - 1<br> End If<br> If Label3.Text = 0 And Label1.Text &gt; 0 And Label5.Text = 0 Then<br> Label1.Text = Label1.Text - 1<br> Label3.Text = 60<br> End If<br> If Label1.Text = 0 And Label3.Text = 1 And Label5.Text = 0 Then<br> Label5.Text = 59<br> Label3.Text = 0<br> End If<br> If Label1.Text = 0 And Label3.Text = 0 And Label5.Text = 0 Then<br> Timer1.Enabled = False<br> End If<br> End Sub
I think you have an error with the code under &quot;Private Sub Timer1_Tick...&quot;.<br><br>I've been messing with the coding of this part for hours, but I still don't have any luck. They way you have it coded, when it reaches 1 minute, it starts making the hours negative. The timer never reaches 00:00:00.<br><br>Am I doing something wrong? <br>It's all just getting really jumbled now.<br>What I have been messing around with:<br><br>Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br> If Label5.Text = 0 Then<br> Label5.Text = 59<br> Label3.Text = Label3.Text - 1<br> ElseIf Label5.Text &gt; 0 Then<br> Label5.Text = Label5.Text - 1<br> End If<br> If Label3.Text = 0 And Label1.Text &gt; 0 And Label5.Text = 0 Then<br> Label1.Text = Label1.Text - 1<br> Label3.Text = 59<br> End If<br> If Label1.Text = 0 And Label3.Text = 1 And Label5.Text = 0 Then<br> Label5.Text = 59<br> Label3.Text = 0<br> End If<br> If Label1.Text = 0 And Label3.Text = 0 And Label5.Text = 0 Then<br> Timer1.Enabled = False<br> End If<br> End Sub
I am a beginner of Visual Basic Programming.. and I am confuse with this: <br> Label1.Text = NumericUpDown1.Text<br> Label3.Text = NumericUpDown2.Text<br> Label5.Text = NumericUpDown3.Text<br><br>I thought if you use label the code will be like this:<br> Label1.Caption=NumercicUpDown1.Caption<br> Label2.Caption=NumercicUpDown2.Caption<br> Label3.Caption=NumercicUpDown3.Caption<br><br>
what size font is the 00:00:00 ?
About 20 and bold
Thanks for the Reply.

About This Instructable

107,596 views

9 favorites

License:

More by patsquare: Raspberry Pi + Arduino Serial with LCD Screen Simple Timer in Visual Basic 2010
Add instructable to: