Working with Threads in C#

Thread , Csharp , .net Iran
  • 10 years ago
    private void btnStop_Click(object sender, EventArgs e)
            {
               if (MyThread.ThreadState == ThreadState.Running)
                    MyThread.Abort();
            }
    

    As you can see from the above code, I want to abort the thread but when I click the btnStop then the thread is still running. What's the problem?

    Thank you

  • 10 years ago

    not the same thread

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is anticipated with distaste, performed with reluctance, and bragged about forever.” - Dan Kaminsky