tom

tom

  • NA
  • 3
  • 0

Problem updating a GUI

Nov 2 2008 12:53 PM
Hi there, I have a problem whereby I cannot change a Component, for instance a Label's text. When debugging, the debugging stops at this line and the label is not changed. I have 2 classes; one is a simple class with an Event which is called on certain conditions. The 2nd class extends Form. The first thread creates the 2nd straight away by calling Application.Run(form2). The form displays fine. However, when the event is triggered in the first form, and I call form2.changeText(string), the label is never changed. I read about problems and I tried to use a Delegate in the first thread like so: public delegate void ChangeLabel(String text); private void triggeredByEvent(String newInfo) { ChangeLabel test = new ChangeLabel(form2.ChangeLabel); test(tag); } However when debugged, the debugging simply stops. I am assuming I am doing something wrong such as the 1st class should not Application.Run(form2) ? Any help would be very much appreciated; I am at my wit's end! - Tom

Answers (3)