I want to use thread and close my form after some operations.But I get a cross thread error .solutions?
new System.Threading.Thread(s =>
{
Close; }).Start();
I want to use thread and close my form after some operations.But I get a cross thread error .solutions?
new System.Threading.Thread(s =>
{
Close; }).Start();
you have to but the close(); statement in this for WPF
Application.Current.Dispatcher.Invoke(() =>
{
// Code to run on the UI thread.
});
and in this for WinForms
this.BeginInvoke(new MethodInvoker(delegate
{
// Code to run on the UI thread.
});