Link to home
Start Free TrialLog in
Avatar of joe_g99
joe_g99

asked on

Adding controls outside of a thread

Hi,

I have a bit of code that loops getting data from a web call, this runs as a thread, when data is returned I need to add this to a control on my app, in VB you would do this with a delegate but in c# my code get to the point of adding the control and doesnt go any further, it doesnt error but doesnt pass the Controls.Add line. can anyone provide any code to demonstrate how to make a thread call a delegate to add a control to the main app?

Cheers

Joe.
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes thats right you need to use Control.invoke or Control.BeginInvoke method for updating your progress bar.
You can not update UI from other threads.

You will find a example here
https://www.experts-exchange.com/questions/21215229/Displaying-progress-during-execution.html

Jatinder