STAThread attribute

  • Thread starter Thread starter Alberto
  • Start date Start date
Alberto,

The STAThread attribute basically tells the runtime to set the apartment
model for thread that the application is first run on. It allows the
threading model to be set before any initialization code is called (which
might happen before your code is reached by the runtime).

It's needed for some of the windows controls, as they are wrappers to
COM components which require the COM environment to be set up properly.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

STAThread vs non STAThread framework 15
[STAThread] 1
section 1
main function attributes 1
Main() questions 3
STAThread and windows form 7
[STAThread] 22
Basic questions 1

Back
Top