|
-
May 19th, 2003, 02:37 PM
#1
Thread Starter
Junior Member
VB Need Help on a trouble shoot
Option Explicit
Private intincrement As Integer
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
Command2.Visible = False
Command3.Visible = True
aol1(0).Visible = True
aol1(1).Visible = False
aol1(2).Visible = False
intincrement = 0
Timer1.Interval = 1
End Sub
Private Sub Command3_Click()
Command3.Visible = False
Command2.Visible = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Private Sub Tmraol_Timer()
aol1(intincrement).Visible = False
If intincrement = 2 Then
intincrement = 0
Else
intincrement = intincrement + 1
End If
aol1(intincrement).Visible = True
End Sub
This is my code. It is a code for a timer. It runs more like a clock and I would like it to start from zero instead of starting from the same time my computer is. I would also like my command button to stop the counting but not unload the program.
-
May 19th, 2003, 02:44 PM
#2
PowerPoster
Label1.Caption = Time
This telling it to use the current time (as it is on your system).
-
May 19th, 2003, 03:26 PM
#3
I assume you have only one form in your project. That is why when you do the following
Private Sub Command1_Click()
Unload Me
End Sub
it ends the app.
If you want to stop the timer, do the following instead
Private Sub Command1_Click()
Timer1.Enabled = false
End Sub
and to display a counter in your label do
Private Sub Timer1_Timer()
Static lngTimer As Long
Label1.Caption = lngTimer
lngTimer = lngTimer + 1
End Sub
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
|