Page 1 of 1

Timer (VB)

Posted: Fri Nov 17, 2006 9:16 pm
by Dominatr
Is there a way to create a timer with VisualBasic? I've tried, and see no way so far

Posted: Fri Nov 17, 2006 11:09 pm
by dos mes
VB.Net? or Vb6? I'm pretty sure that both have a timer control in the toolbox though....

Posted: Sat Nov 18, 2006 4:09 am
by Dominatr
VB 2005 express edition I think. There's an updated version?
EDIT: w00t, it has the timer button too. I was thinking I'd have to code it...
EDIT EDIT: And looks like I do :x So I added the timer from the toolbox. Anything else to it?

Posted: Sat Nov 18, 2006 7:01 am
by Patrickssj6
What do you want to do with it?

Posted: Sat Nov 18, 2006 8:04 am
by dos mes
The timer will be shown in the little box towards the bottom of the designer page, and double click the timer, to put in your code there. If you know what you want it to do and you don't know how to do it then just tell us here, I'll try to help you.

Posted: Sat Nov 18, 2006 9:32 am
by Dominatr
I need a simple timer, with buttons to start and stop, for timing things, possibly things that I wish to time with a timing timer to time with

Posted: Sat Nov 18, 2006 1:22 pm
by Patrickssj6
I bet Dos Mes doesn't know this :P

For timing things you need to use another timer.The regular one is 7 milli secs off. :D

Posted: Sat Nov 18, 2006 4:53 pm
by Dominatr
Eh no big problem there. It's 7 milliseconds. Who will notice? :P

Posted: Sun Nov 19, 2006 8:59 am
by dos mes
Is it really? Very weird! How'd you figure that out Pat?

Posted: Sun Nov 19, 2006 5:22 pm
by Patrickssj6
Dos Mes wrote:Is it really? Very weird! How'd you figure that out Pat?
*COUGH*

I think he mentions it in the starter videos somewhere...

http://msdn.microsoft.com/vstudio/expre ... trolVB.wvx

There you go :D

Posted: Sun Nov 19, 2006 6:54 pm
by dos mes
*Cough*

I don't believe I ever watched any of those...

Posted: Wed Nov 22, 2006 10:05 pm
by LuxuriousMeat
Those tutorials are very good for beginners.

Re: Timer (VB)

Posted: Fri Dec 22, 2006 9:49 pm
by VoiDeD
One month bump.. Oh well, I might as well somehow help for anyone else that will ever need the same thing...
Dominatr wrote:Is there a way to create a timer with VisualBasic? I've tried, and see no way so far
System.Timers.Timer class

C# example:

Code: Select all

    class Program {
        static void Main(string[] args) {
            System.Timers.Timer tmr = new System.Timers.Timer();
            tmr.Interval = 1000;
            tmr.Elapsed += new System.Timers.ElapsedEventHandler(tmr_Elapsed);
        }
        static void tmr_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
            //do something
        }
    }
Sorry, but I don't do VB, and you should be able to make some changes or just use this as an example in your app.