| | |
Timer help needed.
![]() |
•
•
Join Date: Oct 2005
Posts: 4
Reputation:
Solved Threads: 0
Hey, I was reffered here by a friend and said that you solved his problem.
I am in High School and im doing SDD. I have been asked to design a washing machine user interface.
I have pretty muched finished. I have a timer, which has diffrent times for diffrent settings (eg 1 hours for regular, 45 mins for delicate etc..)
All was going well until i found out i need to add delay times (1 hour, 3, 6, 9 and 12).
Any idea on how i could go about doing that? Im not very good with VB (I am just learning) and I want to get a good mark.
I can put up the work if it would help solve the problem
Thanks in advance
I am in High School and im doing SDD. I have been asked to design a washing machine user interface.
I have pretty muched finished. I have a timer, which has diffrent times for diffrent settings (eg 1 hours for regular, 45 mins for delicate etc..)
All was going well until i found out i need to add delay times (1 hour, 3, 6, 9 and 12).
Any idea on how i could go about doing that? Im not very good with VB (I am just learning) and I want to get a good mark.
I can put up the work if it would help solve the problem
Thanks in advance
•
•
Join Date: Oct 2005
Posts: 4
Reputation:
Solved Threads: 0
I have 2 timers. Timer1 and Timer2.
I have to add a delay (in this example it's 3 seconds).
so I have a command button that enables Timer2 to count down 3 seconds. When that is done, it should start Timer1.
this is the code.
This freezes my computer.
these are the code to the timers.
THIS IS URGENT
I have to add a delay (in this example it's 3 seconds).
so I have a command button that enables Timer2 to count down 3 seconds. When that is done, it should start Timer1.
this is the code.
•
•
•
•
Private Sub Commandd1h_Click()
txt2Sec.Text = "3"
txt2Min.Text = "0"
txt2Hour.Text = "0"
Timer2.Enabled = True
Do Until txt2Sec.Text = 0 And txt2Min.Text = 0 And txt2Hour.Text = 0
Label10.Visible = True
Loop
Timer1.Enabled = True
End Sub
these are the code to the timers.
•
•
•
•
Originally Posted by Timer2
Private Sub Timer2_Timer()
If txt2Sec.Text = 0 And txt2Min.Text = 0 And txt2Hour.Text = 0 Then
Timer1.Enabled = False
ElseIf txt2Sec.Text > 0 Then
txt2Sec.Text = txt2Sec.Text - 1
Else 'if zero
txt2Sec.Text = 59
If txt2Min.Text > 0 Then 'update mins
txt2Min.Text = txt2Min.Text - 1
Else
'check if Hour is 0, and if it is, then stop timer, else continue
txt2Min.Text = 59
If txt2Hour.Text > 0 Then 'update mins
txt2Hour.Text = txt2Hour.Text - 1
Else
'check if Hour is 0, and if it is, then stop timer, else continue
txt2Hour.Text = 0
End If
End If
End If
End Sub
•
•
•
•
Originally Posted by Timer1
Private Sub Timer1_Timer()
If txtSec.Text = 0 And txtMin.Text = 0 And txtHour.Text = 0 Then
Timer1.Enabled = False
ElseIf txtSec.Text > 0 Then
txtSec.Text = txtSec.Text - 1
Else 'if zero
txtSec.Text = 59
If txtMin.Text > 0 Then 'update mins
txtMin.Text = txtMin.Text - 1
Else
'check if Hour is 0, and if it is, then stop timer, else continue
txtMin.Text = 59
If txtHour.Text > 0 Then 'update mins
txtHour.Text = txtHour.Text - 1
Else
'check if Hour is 0, and if it is, then stop timer, else continue
txtHour.Text = 0
End If
End If
End If
•
•
Join Date: Jun 2005
Posts: 70
Reputation:
Solved Threads: 2
If all Timer2 does is count down 3 secs then switch to Timer1 then the code needed would be something like this:
First set the Interval property of the two timers to 1000 and the Enabled properties to False, and the text of each textbox to 0.
Also have a look at this thread, should be helpful to you:
http://www.daniweb.com/techtalkforum...ighlight=timer
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Command1_Click() txt2Sec.Text = 3 Timer2.Enabled = True End Sub Private Sub Timer2_Timer() txt2Sec.Text = txt2Sec.Text - 1 If txt2Sec.Text = 0 Then Timer2.Enabled = False Timer1.Enabled = True End If End Sub
First set the Interval property of the two timers to 1000 and the Enabled properties to False, and the text of each textbox to 0.
Also have a look at this thread, should be helpful to you:
http://www.daniweb.com/techtalkforum...ighlight=timer
![]() |
Similar Threads
- Timer problems! (Visual Basic 4 / 5 / 6)
- Basketball timer help needed (Java)
- PictureBox + Timer = headache :| (need help) (VB.NET)
- Identifying Drivers needed (Windows 95 / 98 / Me)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Please Help Me
- Next Thread: Need Urgent Solution
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





