I am using a thread pool to do some tests, how can i change a Textbox.text in the form?
ThreadPool.SetMaxThreads(3, 3);
for(int i2 = 0; i2 < 100; i2++)
{
ThreadPool.QueueUserWorkItem(myInt, i2);
}
void myInt(object obj23)
{
int value = (int)obj23;
writeTo(value);
// code to write textbox1.text += value + "\n";
Thread.Sleep(10000);
}
error is because a thread that didnt create the object (textbox1) is trying to change it