Neodammer
09-03-2003, 01:58 AM
Private Sub Timer1_Timer()
' Important Note*** Set Time$ to = Alarmsetting.text due to errors with >
If (Time$ = AlarmSetting.Text And Alarmon) Then
MediaPlayer1.Open App.Path & "\data.dat"
Timer1.Enabled = False
Call stopnoise
End If
Display.Caption = Time$
End Sub
****
GIven this code how would i go about doing that same thing but using the am pm 12 hour format?
gundavarapu
09-03-2003, 02:16 AM
try this...
If (Time$ = AlarmSetting.Text And Alarmon) Then
MediaPlayer1.Open App.Path & "\data.dat"
Timer1.Enabled = False
Call stopnoise
End If
Display.Caption = Format(Time$, "hh:mm:ss AMPM")
Neodammer
09-03-2003, 02:20 AM
try this...
If (Time$ = AlarmSetting.Text And Alarmon) Then
MediaPlayer1.Open App.Path & "\data.dat"
Timer1.Enabled = False
Call stopnoise
End If
Display.Caption = Format(Time$, "hh:mm:ss AMPM")
Ok well you solved part of it, how about Time$ in the if statement ? Problem is because I could say
Format(Time$, "hh:mm:ss AMPM") = alarmsetting.text and alarmon
but how would i go about writting that in the text box alarmsetting.text? in 24 hour format its simple just do 00:00:00 type format.
SpaceFrog
09-03-2003, 02:23 AM
This may help :
MyStr = Format(MyTime, "hh:mm:ss AMPM") ' Returns "05:04:23 PM".
too slow on that one ...
How about using a dtpicker instaed of a textbox for time input ??
gundavarapu
09-03-2003, 02:26 AM
Format returns a Variant, so you can directly compare them
If (Format(Time$, "hh:mm AMPM") = AlarmSetting.Text And Alarmon) Then
MediaPlayer1.Open App.Path & "\data.dat"
Timer1.Enabled = False
Call stopnoise
End If
Display.Caption = Format(Time$, "hh:mm:ss AMPM")
Hope this helps!
Neodammer
09-03-2003, 02:26 AM
This may help :
MyStr = Format(MyTime, "hh:mm:ss AMPM") ' Returns "05:04:23 PM".
too slow on that one ...
How about using a dtpicker instaed of a textbox for time input ??
Not so sure what MyTime does? but if you change it to Time$ it works :)
Neodammer
09-03-2003, 02:29 AM
Ok thanks it works, the only thing now is whats the format i should tell whoever is using this alarm to type as the time in the box? Say for instance He/she is waking up at 6am? Space whats that ? instead of textbox?
SpaceFrog
09-03-2003, 02:37 AM
A date Picker is a control that enables user to "pick" or input date or time, and will return correct format of time.
Neodammer
09-03-2003, 02:39 AM
A date Picker is a control that enables user to "pick" or input date or time, and will return correct format of time.
I see now thanks. So is there a way to do it via text box? just curious now
SpaceFrog
09-03-2003, 02:53 AM
There is a way of diong it with a textbox using format and with quite a lot of testing to check that user does not enter time such as 99:99 pm for example.
Neodammer
09-03-2003, 04:05 AM
There is a way of diong it with a textbox using format and with quite a lot of testing to check that user does not enter time such as 99:99 pm for example.
hmm...I wonder first if this is possible
Dim a,b,c as string
dim fullstr as string
A = H
B = I
C = C
fullstr = A + B + C
Anyway I was getting to several small text box's with one/two # inputs like box one for hours, box two for time, box three for pm/am or just use an option for those
gundavarapu
09-03-2003, 04:20 AM
fullstr= a & ":" & b & ":" & c
Neodammer
09-03-2003, 04:42 AM
fullstr= a & ":" & b & ":" & c
ahh that works thanks
SpaceFrog
09-03-2003, 05:44 AM
You now need to test seperately if cint(a) > 12 and cint(b)>59
for the last one you could just use a combolist too choose between am and pm ....