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 :)

Recommended Answers

All 3 Replies

Yes, post something of what you've done so far, making it a little clearer what you need to do.

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.

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.

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

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

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

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/techtalkforums/showthread.php?t=33357&highlight=timer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.