Click here to Skip to main content
16,013,747 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to run delegates and backgroundworker thread in C#?
When will start delegates thread dose not fire for backgroundworker thread.
When finishes delegates one cycle then start backgroundworker thread.
Posted
Updated 15-Jan-14 23:35pm
v6
Comments
Tomas Takac 15-Jan-14 9:30am    
I really don't understand what are you trying to acomplish. Please could you be more specific? Provide an example perhaps?

1 solution

You need to use UI invocation feature. You cannot call anything related to UI from non-UI thread. Instead, you need to use the method Invoke or BeginInvoke of System.Windows.Threading.Dispatcher (for both Forms or WPF) or System.Windows.Forms.Control (Forms only).

You will find detailed explanation of how it works and code samples in my past answers:
Control.Invoke() vs. Control.BeginInvoke()[^],
Problem with Treeview Scanner And MD5[^].

See also more references on threading:
How to get a keydown event to operate on a different thread in vb.net[^],
Control events not firing after enable disable + multithreading[^].

—SA
 
Share this answer
 
Comments
Maciej Los 15-Jan-14 16:32pm    
+5
Sergey Alexandrovich Kryukov 15-Jan-14 18:43pm    
Thank you, Maciej.
—SA

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