Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dispatcher is not coming on C# Windows Forms Application

I have a C# Windows Forms Application with a progress bar. I want to progress that dynamically based on some method status. I have that method in a separate class, and am creating a new thread for that method, with a delegate to pass the status of the method to the parent thread.

The same situation I am able solve in a WPF application using progressbar.Dispatcher but in a Windows Forms application there is no Dispatcher, even if I use the System.Threading namespace.

progressbar.Dispatcher seems to be available only in a WPF Application.

like image 914
Kishor Avatar asked Nov 23 '12 06:11

Kishor


1 Answers

In winforms you can use the ProgressBar.Invoke or ProgressBar.BeginInvoke to update the control from another thread.

like image 97
sam1589914 Avatar answered Sep 18 '22 10:09

sam1589914