What is the difference

  • Thread starter Thread starter Guest
  • Start date Start date
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM interop
is used.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Bob said:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM interop
is used.

Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin
 
You should't remove the attribute for Windows forms based programs (note
that for VB.NET it's the default), simply because it's not because you don't
use COM that Windows Forms doesn't use it under the covers (think of OLE
drag/drop and ActiveX controls in the toolbox).
Your problem is not directly related to the STAThread attribute anyway.

Willy.


Marcin Grzêbski said:
Bob said:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM
interop is used.

Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin
 
Hi,

THANKS!
:-)
You're hit the 10!

McAfee VirusScan - source of all evil ;-)
[i hope in .NET only]

Cheers!
Marcin
 
Hi Willy,

Thank you too!
Antivirus makes my trouble. But i'm so curios about
[STAThread] relation.

Cheers :-)
Marcin
You should't remove the attribute for Windows forms based programs (note
that for VB.NET it's the default), simply because it's not because you don't
use COM that Windows Forms doesn't use it under the covers (think of OLE
drag/drop and ActiveX controls in the toolbox).
Your problem is not directly related to the STAThread attribute anyway.

Willy.


Bob said:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM
interop is used.

Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin
 
Back
Top