by Polash Kumar Kairi (2 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 26th July 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
A Timer Control System Which Gives You How many times you have used your computer today (Its very Useful)
API Declarations
'##You have need a database whose name "TDBA" a table "Ttable" 'Field "Ddate","Ttime"
a timer , three textbox ,a ADODC control
Dim hou As Integer
Dim mi As Long
Dim see As Integer
Dim db As Connection
Dim rs As Recordset
Set db = New Connection
db.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=TDBA.mdb"
Set rs = New Recordset
rs.Open ("DELETE * FROM Ttable WHERE Ddate <> #" & Date & "#"), db
rs.Open ("SELECT * FROM Ttable"), db
Do Until rs.EOF
hou = hou + Hour(rs.Fields("Ttime"))
mi = mi + Minute(rs.Fields("Ttime"))
see = see + Second(rs.Fields("Ttime"))
rs.MoveNext
Loop
totsee = (hou * 60 * 60) + (mi * 60) + see
mmin = Int(totsee / 60)
fmin = mmin Mod 60
fhou = Int(mmin / 60)
fsee = see Mod 60
Text3.Text = fhou
Text2.Text = fmin
Text1.Text = fsee
If Len(Text1.Text) < 2 Then
Text1.Text = 0 & Text1.Text
End If
If Text1.Text = 60 Then
Text1.Text = 0 & 0
End If
If Len(Text2.Text) < 2 Then
Text2.Text = 0 & Text2.Text
End If
If Text2.Text = 60 Then
Text2.Text = 0 & 0
End If
If Len(Text3.Text) < 2 Then
Text3.Text = 0 & Text3.Text
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
frmtimer.BackColor = RGB(12, 24, 120)
Label1.ForeColor = QBColor(Rnd * 15)
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'If BorderStyle = 1 Then
' Dim aa
' aa = MsgBox("Are You Sure ?", vbYesNo, "Polash Timer")
' If aa = vbNo Then
' Cancel = 1: Exit Sub
' Else
' Unload Me
' End If
'
'End If
'If vbunloadmode = vbFormControlMenu Then Cancel = 1
If vbunloadmode = vbAppWindows Then Cancel = 6
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim db As Connection
Dim rs As Recordset
Set db = New Connection
db.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=TDBA.mdb"
Set rs = New Recordset
Set rs1 = New Recordset
tim = Text3.Text & ":" & Text2.Text & ":" & Text1.Text
rs.Open ("DELETE * FROM Ttable"), db
rs1.Open ("INSERT INTO Ttable(Ddate,Ttime) VALUES(#" & Date & "#,#" & tim & "#)"), db
End Sub
Private Sub Timer1_Timer()
Text1.Text = Val(Text1.Text) + 1
If Len(Text1.Text) < 2 Then
Text1.Text = 0 & Text1.Text
End If
If Text1.Text = 60 Then
Text1.Text = 0 & 0
Text2.Text = Val(Text2.Text) + 1
If Len(Text2.Text) < 2 Then
Text2.Text = 0 & Text2.Text
End If
End If
If Text2.Text = 60 Then
Text2.Text = 0 & 0
Text3.Text = Val(Text3.Text) + 1
If Len(Text3.Text) < 2 Then
Text3.Text = 0 & Text3.Text
End If
End If
total = Text3.Text & ":" & Text2.Text & ":" & Text1.Text
Label1.Caption = total
End Sub
No comments have been posted about A Timer Control System Which Gives You How many times you have used your computer today (Its very U. Why not be the first to post a comment about A Timer Control System Which Gives You How many times you have used your computer today (Its very U.