I am having a TCP client connect to the server. Once it is connected, it should change the label to "Connected". The problem I'm having is that when I create a thread, it's static no matter what.
public static Thread waitForConnectionThread = new Thread(waitForConnection);
This means the method it'll be running also has to be static, which in turn causes me not to be able to access the UI controls.
public static void waitForConnection()
{
server.Start();
client = server.AcceptTcpClient();
labelControl1.Text = "Connected"; <-----------------
}
I also tried Control.Invoke, but since I'm on static thread I wasn't able to get it to work. Is there possibly a way around this?