|
-
Jun 11th, 2002, 11:07 PM
#1
Thread Starter
New Member
Basic Time Question NEED HELP
This is probably a very simple question but I'm just starting to get the hang of this VB thing. It's very simple, I want to be able to click a buton and the program starts counting minutes.
Click once, timer starts
click another button and timer stops
displays minutes in a textbox.
any help would be great. Thanks
-
Jun 11th, 2002, 11:17 PM
#2
Member
make 2 command buttons
name them cmdStartTimer and cmdStopTimer..
VB Code:
Private Sub cmdStartTimer_Click()
Timer1.Enabled = True
End Sub
Private Sub cmdStopTimer_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Text1.Text = "0"
Timer1.Interval = 1000
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Text1.Text = Val(Text1.Text) + 1
End Sub
basically this is the code with no formatting to the text..
-
Jun 11th, 2002, 11:19 PM
#3
VB Code:
Public a As Integer
Private Sub Command1_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
a = a + 1
Text1.Text = a
End Sub
If u need any explanation, jes ask
-
Jun 11th, 2002, 11:20 PM
#4
*** happened to the spaces in [Highlight=VB]???
-
Jun 11th, 2002, 11:22 PM
#5
Member
btw my code counts seconds, so to count by minutes just set the interval of the timer to 60000.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|