Adding controls outside of a thread

Posted on 2005-03-16
Medium Priority
Last Modified: 2010-04-16

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?


Question by:joe_g99
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Accepted Solution

AlexFM earned 1500 total points
ID: 13553924

Winodws control functions should be executed from a worker thread using BeginInvoke or Invoke methods.
LVL 11

Expert Comment

ID: 13554212
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


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question