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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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