Please Help me !

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

Hi All,

I have the following code. If the MessageBox.Show statement is enabled then
the "GetDataTableThread" is being started or else its state remains as
unstarted.

What should I do to start the GetDataTableThread Thread and make sure it is
started?

Any suggestions please?

Thanks for your time

Regards
Anand Ganesh

//////// Code Starts //////////////

this.richTextBoxMessage.Text = "" ;
Thread GetDataTableThread = new Thread(new
ThreadStart(InvokeGetDataTableThread)) ;
GetDataTableThread.Start() ;
//MessageBox.Show("This is main Thread!");
while(!GetDataTableThread.IsAlive) ;
this.richTextBoxMessage.Text = this.richTextBoxMessage.Text + "\n" + "Main
Thread State = " + Thread.CurrentThread.ThreadState.ToString() ;
this.richTextBoxMessage.Text = this.richTextBoxMessage.Text + "\n" +
"GetDataTableThread State = " + GetDataTableThread.ThreadState.ToString() ;
GetDataTableThread.Abort() ;
this.richTextBoxMessage.Text = this.richTextBoxMessage.Text + "\n" + "Thread
aborted!" ;
GetDataTableThread.Join() ;

//////// Code Ends //////////////
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top