Form form1 = new Form();
Thread newThread = new Thread(() =>
form = form1
);
newThread.Start();
while(form == null)
{
WAIT?
}
Can anyone help me how to make thread wait befor going on with execution? And not to use thread.sleep?
You can use a ManualResetEvent:
var mre = new ManualResetEvent(false);
Form form1 = new Form();
Thread newThread = new Thread(() => {
form = form1;
mre.Set();
});
newThread.Start();
mre.WaitOne();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With