Converts the time in Seconds to hh:mm:ss Format
Converts the time in Seconds to hh:mm:ss Format
API Declarations
'The answer will be displayed in a message box.
Rate Converts the time in Seconds to hh:mm:ss Format
(2(2 Vote))
s = Text1.Text
sec = s Mod 60
If sec < 10 Then
sec = "0" & sec
End If
m = s \ 60
mins = m Mod 60
If mins < 10 Then
mins = "0" & mins
End If
hrs = m \ 60
If hrs < 10 Then
hrs = "0" & hrs
End If
MsgBox (hrs & ":" & mins & ":" & sec)
End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
'This code is to prevent the user from making any invalid entries.
'He can enter only integers. no decimals or negative nos.
'The textbox has a Maxlenth of 9 characters.
n = Len(Text1.Text)
rt = 1
For i = 1 To n
x = Mid(Text1.Text, i, 1)
If Not (x >= 0 And x <= 9) Then
rt = rt * 0
End If
Next
If rt = 0 Or Text1.Text = "" Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub
Converts the time in Seconds to hh:mm:ss Format Comments
No comments yet — be the first to post one!
Post a Comment