944,179 Members | Top Members by Rank

Ad:
Oct 15th, 2005
0

Timer help needed.

Expand Post »
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
Similar Threads
Y2A
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Y2A is offline Offline
4 posts
since Oct 2005
Oct 16th, 2005
0

Re: Timer help needed.

Yes, post something of what you've done so far, making it a little clearer what you need to do.
Reputation Points: 11
Solved Threads: 2
Junior Poster in Training
w00dy is offline Offline
70 posts
since Jun 2005
Oct 17th, 2005
0

Re: Timer help needed.

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.
Quote ...
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
This freezes my computer.

these are the code to the timers.

Quote 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
Quote 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
THIS IS URGENT
Y2A
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Y2A is offline Offline
4 posts
since Oct 2005
Oct 17th, 2005
0

Re: Timer help needed.

If all Timer2 does is count down 3 secs then switch to Timer1 then the code needed would be something like this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. txt2Sec.Text = 3
  3. Timer2.Enabled = True
  4. End Sub
  5.  
  6. Private Sub Timer2_Timer()
  7. txt2Sec.Text = txt2Sec.Text - 1
  8.  
  9. If txt2Sec.Text = 0 Then
  10. Timer2.Enabled = False
  11. Timer1.Enabled = True
  12. End If
  13.  
  14. 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
Reputation Points: 11
Solved Threads: 2
Junior Poster in Training
w00dy is offline Offline
70 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Please Help Me
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Need Urgent Solution





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC