VB icon

A little clock that sits on your desktop

Email
Submitted on: 1/4/2015 10:41:00 AM
By: Mike-Ejeet 9t9 (from psc cd)  
Level: Beginner
User Rating: By 4 Users
Compatibility: VB 4.0 (16-bit), VB 4.0 (32-bit)
Views: 736
 
     This gives the code for a little arlarm clock that sits on your desktop. The soul purpose of this application is to give the current time. Very Simple.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: A little clock that sits on your desktop
' Description:This gives the code for a little arlarm clock that sits on your desktop. The soul purpose of this application is to give the current time. Very Simple.
' By: Mike-Ejeet 9t9 (from psc cd)
'
' Inputs:1 timer- Interval 500 and name timer 1
'**************************************

I(n the form itself enter this code:
Private Sub Form_Click()
AlarmTime = InputBox("Enter alarm time", "VB Alarm", AlarmTime)
If AlarmTime = "" Then Exit Sub
If Not IsDate(AlarmTime) Then
MsgBox "The time you entered was not valid."
Else' String returned from InputBox is a valid time,
AlarmTime = CDate(AlarmTime)' so store it as a date/time value in AlarmTime.
End If
End Sub
**********In the timer enter this code:*****************
Private Sub Timer1_Timer()
Static AlarmSounded As Integer
If lblTime.Caption <> CStr(Time) Then
' It's now a different second than the one displayed.
If Time >= AlarmTime And Not AlarmSounded Then
Beep
MsgBox "Alarm at " & Time
AlarmSounded = True
ElseIf Time < AlarmTime Then
AlarmSounded = False
End If
If WindowState = conMinimized Then
' If minimized, then update the form's Caption every minute.
If Minute(CDate(Caption)) <> Minute(Time) Then SetCaptionTime
Else
' Otherwise, update the label Caption in the form every second.
lblTime.Caption = Time
End If
End If
End Sub


Other 4 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.