• Log in or sign up for an account here: https://www.sythe.org/login

Make a timer in vb

  • Thread starter Thread starter iwanttoauto
  • Start date Start date
I

iwanttoauto

Guest
Make a timer in vb
I am working on a custom client and i need to add a timer that displays the time the user has been on.
I am using vb.net 2008 express.

I've tried everything

Any help? I've tried to Google it as well.
 
Make a timer in vb
Lol nice your like me here,
Label as the time the person has been on - Label1
Button as starter for timer - Button1

1. At the top of your form's code beneath Public Class (Form1) put,

Code:
Dim Time as integer = 0

2.under timer tick event (Double click the timer) put this code,
And in properties box when you've clicked the timer once to the right the property that says Interval change to 1000 (1 second in mille seconds)
Code:
Time += 1
Label1.text = Time

there that will make the label go 1,2,3,4,5,6,7,8,9,10 etc. once it gets to 60,61,62 so if you want it to go 59,1:00,1:01 then tell me.
 
Two Factor Authentication User
Make a timer in vb
It would be better to use a StopWatch since it is much more accurate.

Under the timer's Tick event, you could just use this code.
Code:
Static Watch As Stopwatch = Stopwatch.StartNew
Dim Time As String = Watch.Elapsed.ToString.Split("."c)(0)
If Label1.Text <> Time Then Label1.Text = Time
Also, Static means that the variable will keep the exact same value every time the method is called.
 
Runescape Gamblingrunescape gambling
Back
Top