G
gwoodhouse
Hello all,
I have an application at the moment which uses forms. The main form
(which has ALOT of things going on it in) also happens to do alot of
network proccess's which ive put in Threads.
DUring refactoring i decided i wanted to seperate as much non-form
related logical from the main page as i could. I created a new static
class, thinking i could call a "ThreadStart" method which, when it
needs to access form elements, drops into the main form through an
Invoke();
My problem is from my new class i can't use the Invoke() method. Ive
tried to solve this on my own and my theory is that the static class
doesnt know the Control that created it (because it wasnt created) so
therefor static methods can't use Invoke() ? ?
Could someone please tell me how to do something say...
mainThread.Invoke(mainThreadMethodHere)? (Or if im going about this
the wrong way - or if there is a better way - let me know?)
Thanks very much in advance!
Graeme
I have an application at the moment which uses forms. The main form
(which has ALOT of things going on it in) also happens to do alot of
network proccess's which ive put in Threads.
DUring refactoring i decided i wanted to seperate as much non-form
related logical from the main page as i could. I created a new static
class, thinking i could call a "ThreadStart" method which, when it
needs to access form elements, drops into the main form through an
Invoke();
My problem is from my new class i can't use the Invoke() method. Ive
tried to solve this on my own and my theory is that the static class
doesnt know the Control that created it (because it wasnt created) so
therefor static methods can't use Invoke() ? ?
Could someone please tell me how to do something say...
mainThread.Invoke(mainThreadMethodHere)? (Or if im going about this
the wrong way - or if there is a better way - let me know?)
Thanks very much in advance!
Graeme