J
Jon Skeet [C# MVP]
j m said:I changed my Form to not use the Threadpool at all and instead use
Application.Run(new Form1()); (please see earlier in the thread).
I then started the thread in the Form_Load.
The problem, for me anyway, is that I am calling that Form1 that started
the thread from the clsListen.
Here is what I don't understand, then: If I can start a thread like
this and pass it my form via "this," keyword, constructor in the class
ready to receive, then why can't I reference it? Why does it work at
all (which though it is wrong, it is working)?
It does not appear that I should ever be able to pass a thread
*anything* with the "this" keyword as I can never reference back to the
"this" that I sent it. At least not the UI part of it. I am guessing I
could use other variable/controls' values on the form to make
calculations, just not physically updating a control on the form.
You can use the reference to your form (the fact that you passed it as
"this" in a method is irrelevant) but only in order to call Invoke,
BeginInvoke, InvokeRequired and CreateGraphics on it.
You could use other variables, but not controls, and you'd still need
to synchronize as you have to for all shared data.