stopwatch / countdown timer

Discussion in 'Programming General' started by mama luigi, May 6, 2010.

stopwatch / countdown timer
  1. Unread #1 - May 6, 2010 at 7:31 PM
  2. mama luigi
    Joined:
    May 5, 2010
    Posts:
    11
    Referrals:
    0
    Sythe Gold:
    0

    mama luigi Newcomer

    stopwatch / countdown timer

    how would you make a stopwatch or a countdown timer, I can't seem to be able to figure out the code.

    Thanks in advance.
     
  3. Unread #2 - May 8, 2010 at 8:24 AM
  4. Harlem9191
    Joined:
    Mar 10, 2009
    Posts:
    81
    Referrals:
    0
    Sythe Gold:
    0

    Harlem9191 Member

    stopwatch / countdown timer

    You would use a label and a timer.
    Declare a variable with an integer data type and make the variable hold the number you want it to start counting down from.
    Then in the tick event you would do:

    Variable = Variable - 1
    [Label].Text = Variable.ToString
     
  5. Unread #3 - May 8, 2010 at 8:31 AM
  6. Harlem9191
    Joined:
    Mar 10, 2009
    Posts:
    81
    Referrals:
    0
    Sythe Gold:
    0

    Harlem9191 Member

    stopwatch / countdown timer

    Code:
    Dim intCountDown As Integer = 200   'The number you want to count down from here
    
    Private Sub tmrCountDown_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrCountDown.Tick
    
    intCountDown = intCountDown - 1   'Minus 1 off the varable
    
    lblCountDown.Text = intCountDown.ToString   'Display/update the variable in a label
    
    End Sub
    

    If you didn't understand what I said in my previous post then just copy the code I did above and just drag a label onto your form and call it 'lblCountDown'. Then drag a timer onto your form and call it 'tmrCountDown'.
     
< Microsoft DreamSpark Codes? | LOcate >

Users viewing this thread
1 guest


 
 
Adblock breaks this site