Timer (VB)

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
Dominatr





Posts: 861
Joined: Fri Oct 07, 2005 10:52 pm
Location: Shooting Nazis, Zombies, and anything inhuman

Timer (VB)

Post by Dominatr »

Is there a way to create a timer with VisualBasic? I've tried, and see no way so far
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post by dos mes »

VB.Net? or Vb6? I'm pretty sure that both have a timer control in the toolbox though....
Dominatr





Posts: 861
Joined: Fri Oct 07, 2005 10:52 pm
Location: Shooting Nazis, Zombies, and anything inhuman

Post 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?
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post by Patrickssj6 »

What do you want to do with it?
...left for good
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post 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.
Dominatr





Posts: 861
Joined: Fri Oct 07, 2005 10:52 pm
Location: Shooting Nazis, Zombies, and anything inhuman

Post 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
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post 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
...left for good
Dominatr





Posts: 861
Joined: Fri Oct 07, 2005 10:52 pm
Location: Shooting Nazis, Zombies, and anything inhuman

Post by Dominatr »

Eh no big problem there. It's 7 milliseconds. Who will notice? :P
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post by dos mes »

Is it really? Very weird! How'd you figure that out Pat?
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post 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
...left for good
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post by dos mes »

*Cough*

I don't believe I ever watched any of those...
User avatar
LuxuriousMeat





Posts: 824
Joined: Thu Nov 03, 2005 6:43 pm
Location: zzzzzzzzzzzzzzzz
Contact:

Post by LuxuriousMeat »

Those tutorials are very good for beginners.
Image
User avatar
VoiDeD
Readers Club




Socialist

Posts: 1866
Joined: Thu Jan 15, 2004 4:46 pm
Location: Gurnee, IL
Contact:

Re: Timer (VB)

Post 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.
Image
Post Reply