Threading
-
Hi, the Main() method of an app has to be static, that is where the app starts. Apart from that, no method has to be static. I typically create a "Job" class that holds the job's parameters and then creates a thread and runs it, nothing static in there. :)
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
-
Sure... The
static
keyword has nothing to do with how the code is executed, but only with where it lives (instance or type). Static/not static is simply irrelevant when it comes to different threads. In the end, it's all bytes that run through the processor, no matter where they come from... Regards Thomaswww.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software. -
Wogboiii wrote:
Can you use threading without a static method?
I don't see any static methods other than main in the example code in the documentation for BackgroundWorker[^], do you?
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
Sure... The
static
keyword has nothing to do with how the code is executed, but only with where it lives (instance or type). Static/not static is simply irrelevant when it comes to different threads. In the end, it's all bytes that run through the processor, no matter where they come from... Regards Thomaswww.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.I think the original poster saw an example using a static method to start a new thread and thought it was a requisite.