Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what code for a Timer Aplication.. whcich turns an alarm

Status
Not open for further replies.

JPirate

Programmer
Aug 11, 2003
44
PR
I need to make a timer witch enables me to turn on or off 3 different types of equiptment.. remotely... . and lets me program the timer to turn them on or off using ports at a specific hour and date.... can someone help me with any code? Using Visual Basic :) ... i need more help with the timer code
 
This isn't much, but you might get the gist of things.

Remember to put the timer control on your form.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' TIMER
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Timer1_Timer()
Static AlarmSounded As Integer
Dim dDate As Date
Dim vToday As String
Dim vDayBefore As String
Dim dClock As Integer

AlarmSounded = False


If lblTime.Caption <> CStr(Time) Then ' It's now a different second than the one displayed.
lblTime.Caption = Time
vToday = Format(Now, &quot;ddd&quot;)

' ALARM SOUNDED?
If Time > AlarmTime Then AlarmSounded = True

' RUN AVERAGING PROGRAM
If Time > vRunAvgTimer01 And Time < vRunAvgTimer02 Then
Call Program01
Exit Sub
End If

' RUN TIMED DAILY EXPORT PROGRAM
If Time >= AlarmTime And Not AlarmSounded Then
If vToday <> &quot;Mon&quot; _
And vToday <> &quot;Tue&quot; _
And vToday <> &quot;Wed&quot; _
And vToday <> &quot;Thu&quot; _
And vToday <> &quot;Fri&quot; Then
Exit Sub
Else
Call Program02
End If
ElseIf Time < AlarmTime Then
AlarmSounded = False
End If
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top