O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

STAThread Attribute

Class

System.STAThreadAttribute

Applies to

Method

Description

Specifies that the class or application to which the program element belongs is to use the single-threaded apartment model for COM interop. If COM components are not called from the class or application, the attribute is ignored. The <STAThread> attribute should be used only on the class or application’s Main method or subroutine.

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

Constructor

New(  )

Properties

None

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required