Re: [2005] Making A Timer
.NET 2.0 includes the Stopwatch class that will do exactly what you want. You just create an instance and call the appropriate methods when the Button is clicked. I would also recommend that you use a CheckBox instead of a Button. If you set the Appearance property of the CheckBox to Button then it looks exactly like a regular Button control, but when you press it it stays depressed until you press it again. Depressed corresponds to checked and released corresponds to unchecked.
Re: [2005] Making A Timer
so how do I set up one of these stopwatches?
Re: [2005] Making A Timer
You create an instance and then check the documentation or use Intellisense to see what members it has. The documentation has a code example. The following page is the result of searching for "stopwatch class" on MSDN.
http://search.msdn.microsoft.com/sea...topwatch+class
Re: [2005] Making A Timer
nooob question: and, what is an instance ?
Re: [2005] Making A Timer
Quote:
Originally Posted by Danillo55
nooob question: and, what is an instance ?
Every object is an instance of its type. In the real world Person is a type and you are an instance of that type. In VB you have to use the 'New' keyword to create an instance of a class, e.g.
VB Code:
Dim myStopwatch1 As Stopwatch 'This declares a variable but does not create an instance, so the variable is Nothing.
Dim myStopwatch2 As New Stopwatch 'This declares a variable and does create an instance, so the variable refers to a Stopwatch object.
Dim myStopwatch3 As Stopwatch = New Stopwatch 'This is equiavlent to the above.