|
-
Dec 4th, 2002, 04:54 PM
#1
Thread Starter
Addicted Member
Timers and Threading
This is going to sound like an odd question.... but does anyone know if, in VB.NET (and the rest of the CLR) timers spawn new threads of execution when they're instantiated?
I'm asking basically in reference to the Outlook Add In post I made. I tried eliminating the timer that was driving the whole thing and put in a loop... but a loop would basically prevent the addin from ever letting Outlook fully load. THe user wouldn't be able to do anything but stare at Outlook with an hourglass. This is because the thread that Outlook was running on was busy.
However, using a loop like that all of my objects worked properly.... Using a timer, the object's properties said "Error: Unable to retrive data" in the watch window. Using a seperate thread for the timer to execute on had the same effect.
My theory is that by instantiating a timer object you create a seperate thread containing whatever code you're using in the elapsed event. That way the main execution thread of your program isn't interupted by the fact that you've got what esentially is a loop checking to see if X amount of time has passed since it's last execution.
Anyone? Anyone? Beuhler?
Eiredrake
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|