Click to See Complete Forum and Search --> : I Urgently Need Help About Threading !


Noreturn
May 9th, 2007, 02:50 PM
I'm writing a programme for my final project which I have to finish in two days :(. This programme includes a TCPListener to get some data over TCP/IP protocols. So I've made a second thread for this TCPListener. Otherwise, other components woudn't work at the same time due to infinite loop as u predict. But, now I have an other problem; When I start my thread as I wrote below;

Form1^ s = gcnew Form1();
ThreadStart^ serverDelegate = gcnew ThreadStart(s,&MyMessenger::Form1::ServerActivate);
Thread^ serverThread = gcnew Thread(serverDelegate);
serverThread->Start();

ServerActivate function (which includes TCPListener) works correctly, can call other functions, but while this thread is working I can not control the properties of components of Form1, such as textbox->text. I've tried many things, but I couldn't. Please help me, how can I solve this problem?

Arjay
May 10th, 2007, 12:57 PM
Two questions:


Are you waiting for this thread to finish in the UI thread?
Can you post the code for the thread? I ask because if the thread is in a tight loop, it may starve the UI thread from cpu time.