Threading question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it safe to create a form in a worker thread and then have the UI thread
display and take control of it? I would think that this would not be safe.
However, .net 2.0 does not give me a cross threading error and it works
consistently with all of my forms except for one.
 
<=?Utf-8?B?U2NvdHQgU2ltb25z?=
Is it safe to create a form in a worker thread and then have the UI thread
display and take control of it?
No.

I would think that this would not be safe.
However, .net 2.0 does not give me a cross threading error and it works
consistently with all of my forms except for one.

I'm surprised that it's not giving you an error, but no, it's not safe.
Always create GUI elements on the same thread you'll be touching them
on.
 
Scott Simons said:
Is it safe to create a form in a worker thread and then have the UI thread
display and take control of it? I would think that this would not be
safe.
However, .net 2.0 does not give me a cross threading error and it works
consistently with all of my forms except for one.

Cross-threading probes are only active in debug mode.

Willy.
 
Back
Top