In Timer1_Tick control, put this code below.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If TimeOfDay = DateTimePicker1.Text Then
Dim voice = CreateObject("SAPI.spvoice")
voice.speak(TextBox1.Text)
lblStatus.Text = "Alarm is not set!"
End If
End Sub
In Timer2_Tick control, put this code below.
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
lblCurtime.Text = TimeOfDay
End Sub
In our Form1_Load, put this code below.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer2.Enabled = True
End Sub
This will display the current time when loading the form.In our Button1_Click for the setup of the alarm, put this code below.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSetAlarm.Click
Timer1.Enabled = True
lblStatus.Text = "Alarm is set!"
End Sub
Timer1 is enabled because we have set the time of the alarmed time to be equal to the current time and will display to the user that time is now set!
0 comments:
Post a Comment