STAThread Attribute


STAThread Attribute

Class

System.STAThreadAttribute

Applies To

Method

Constructor

     New(  ) 

Properties

None defined

Description

The <STAThread > attribute indicates that the application to which the program element belongs uses the single-threaded apartment model for COM interop. The attribute should be applied to the application's Main method or subroutine. This attribute only applies to applications that use COM interop.

The <STAThread> attribute is similar to setting a System.Threading.Thread object's ApartmentState property to ApartmentState.STA. The difference is that the <STAThread> attribute creates a single-threaded apartment from startup, while setting the property does it only from the point that the property is set.

See Also

MTAThread Attribute




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net