Results 1 to 3 of 3

Thread: VB Need Help on a trouble shoot

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    16

    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.

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951
    Label1.Caption = Time


    This telling it to use the current time (as it is on your system).

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    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
  •  



Click Here to Expand Forum to Full Width