This is my code. The bold part says something about an invalid thread state. How to stop and run the thread from private void comboBox1_Selec tionChanged(obj ect sender, SelectionChange dEventArgs e) ?
Code:
using ....
namespace ns
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public Thread stre;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// run test()
}
void test()
{
stre = new Thread(unused => threadname(content));
stre.Start();
}
void threadname(content content)
{
}
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (stre != null)
{
stre.Abort();
}
[B]stre.Start();[/B]
}
}
}