G
Guest
Under my button click event, I have code that will call another method that takes 3-4 seconds. I want to be call that method and be free to do something else. I know this can be done with threading, but I just can't seem to get it right. Below is what I have so far. The Join statement is what is holding up the code.
Any suggesstions
Thanks
private void btnSend_Click(object sender, System.EventArgs e
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
Thread thread1 = new Thread(new ThreadStart(sendMsg))
thread1.Name= "JMS"
thread1.Start();
int count=0
thread1.Join();
while (this.msgReceived == false
count++
Console.WriteLine(thread1.ThreadState.ToString())
Console.WriteLine("sendMsg: " + count);
Any suggesstions
Thanks
private void btnSend_Click(object sender, System.EventArgs e
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
Thread thread1 = new Thread(new ThreadStart(sendMsg))
thread1.Name= "JMS"
thread1.Start();
int count=0
thread1.Join();
while (this.msgReceived == false
count++
Console.WriteLine(thread1.ThreadState.ToString())
Console.WriteLine("sendMsg: " + count);