Dynamic creation of controls

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

Hello all together,

I'm trying to combine a TCP Socket Connection with ONE Form to receive some
kind of XML documents containing elements that should be displayed as
controls (i.e. labels and textboxes for now).

The receiving of such xml documents and the parsing is not a problem, but
....

The Talker class is sending a notification to the form, containing the xml
doc as string.

Appearantly the Notificationhandler cannot call the
this.Controls.Add(control) method to add the control to the controls of the
form.

When I try this in the InitializeComponents() method of the form or on a
Push button I can dynamically create controls and display them, but not from
within the notification handler.

Am I doing something wrong or am I stupid ?

regards

Thomas
 
The notificationhandler is on another thread, so you have to marshal calls
back to the UI thread and create from there.

-Chris
 
Back
Top