Click here to Skip to main content
15,868,006 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
// For Start Button
public void MyAction1()
{
  // Code Here
}

// For Exit Button function

public void MyExit1()
{
    Thread thrd1 = new Thread(() => MyAction1());
    thrd1.Abort();
}


How should i Stop MyAction1() Function Using Thread.
Posted

1 solution

Since you're using WPF I would recommend using tasks instead of directly starting new threads. Have a look at Task class[^] and for example Using the Task Parallel Library (TPL) in WPF[^] or Task Parallel Library: 6 of n[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900