I have a count-up timer that I built using VB6. I have all of the proposed functions working, save one.
I would like to have the accumulated time (currently displayed in a 'label' sent (automatically) to the clipboard so that I can paste that value into a record of time spent on a project.
The 'send to clipboard' event would take place when I click the 'Stop' button (which haults the count and awaits user-input to restart from the current value or to be reset to 00:00:00 for a new count).
I have tried to modify source code (that was supposed to send to clipboard) that I have gleaned from other sources but, nothing seems to work. I have since removed the attempts from my code and didn't have sense enough to keep them
I am very 'green' in VB but nonetheless happy with my project thus far - mainly because it works!!
I am looking for a reference to (or I am looking for help writing) the necessary code. I have included what I have so far (save the portion that I dismembered and dumped!)
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Form_Load()
lblTicker1.Caption = "00:00:00" 'Formats the label view
SetWindowText LvTimer3.hwnd, "Live Timer 3"
End Sub
Private Sub tmrStart1_Click()
tmrTicker1.Enabled = True 'Start timer and then . . .
'Form1.WindowState = 1 'Minimizes form to the Task Bar. NOTE: timer is still counting
LvTimer3.WindowState = vbMinimized
End Sub
Private Sub tmrStop1_Click()
tmrTicker1.Enabled = False 'Stops timer; but keeps app live on desktop
'<--Clicking Start again will reactivate timer starting @ the current count value. You can restart the count multiple times always beginning with the last value counted.-->
End Sub
Private Sub tmrClose1_Click()
End ' Closes the Application
End Sub
Private Sub tmrClear1_Click()
' Clear the current value of timer
lblTicker1.Caption = "00:00:00" 'Resets Timer to zero for next count.
txtTicker1.Text = "00:00:00" 'Resets Textbox to zero for next count.
tmrTicker1.Enabled = False
End Sub
Private Sub tmrTicker1_Timer() 'Timer for "count-up"
lblTicker1.Caption = Format(TimeValue(lblTicker1.Caption) + TimeValue("00:00:01"
, "hh:mm:ss"
'Formats the display view and always adds "1" to time.
txtTicker1.Text = Format(TimeValue(lblTicker1.Caption) + TimeValue("00:00:01"
, "hh:mm:ss"
'Formats the display view and always adds "1" to time.
End Sub 'Oz; 1-June-2002
Thank you, in advance!
ViperGTS
I would like to have the accumulated time (currently displayed in a 'label' sent (automatically) to the clipboard so that I can paste that value into a record of time spent on a project.
The 'send to clipboard' event would take place when I click the 'Stop' button (which haults the count and awaits user-input to restart from the current value or to be reset to 00:00:00 for a new count).
I have tried to modify source code (that was supposed to send to clipboard) that I have gleaned from other sources but, nothing seems to work. I have since removed the attempts from my code and didn't have sense enough to keep them
I am very 'green' in VB but nonetheless happy with my project thus far - mainly because it works!!
I am looking for a reference to (or I am looking for help writing) the necessary code. I have included what I have so far (save the portion that I dismembered and dumped!)
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Form_Load()
lblTicker1.Caption = "00:00:00" 'Formats the label view
SetWindowText LvTimer3.hwnd, "Live Timer 3"
End Sub
Private Sub tmrStart1_Click()
tmrTicker1.Enabled = True 'Start timer and then . . .
'Form1.WindowState = 1 'Minimizes form to the Task Bar. NOTE: timer is still counting
LvTimer3.WindowState = vbMinimized
End Sub
Private Sub tmrStop1_Click()
tmrTicker1.Enabled = False 'Stops timer; but keeps app live on desktop
'<--Clicking Start again will reactivate timer starting @ the current count value. You can restart the count multiple times always beginning with the last value counted.-->
End Sub
Private Sub tmrClose1_Click()
End ' Closes the Application
End Sub
Private Sub tmrClear1_Click()
' Clear the current value of timer
lblTicker1.Caption = "00:00:00" 'Resets Timer to zero for next count.
txtTicker1.Text = "00:00:00" 'Resets Textbox to zero for next count.
tmrTicker1.Enabled = False
End Sub
Private Sub tmrTicker1_Timer() 'Timer for "count-up"
lblTicker1.Caption = Format(TimeValue(lblTicker1.Caption) + TimeValue("00:00:01"
txtTicker1.Text = Format(TimeValue(lblTicker1.Caption) + TimeValue("00:00:01"
End Sub 'Oz; 1-June-2002
Thank you, in advance!
ViperGTS