set my thread to enter STA

  • Thread starter Thread starter Daylor
  • Start date Start date
D

Daylor

hi.
i have a thread ,with form.
and there is no COM object when he runs.

can i still set this thread to run as STA ,even, if i dont use com object ?
 
can i still set this thread to run as STA ,even, if i dont use com object ?

Yes.

For the main thread you don't have to do it, since Main() in VB.NET
implicitly is given the STAThread attribute.



Mattias
 
well , the important thing i want to know :

in code the thread.currentthread.apartmentstate is STA , (when i read the
value)
now, as i said, i dont use com object in that thread.

this thread is actcually running in STA ?
cause i can see other thread's can access objects created by the this
thread,
and its not act like STA.

what wrong here ?
 
I did some research into this awhle back. <STAThread> attribute only
applies to COM exposed objects. Otherwise, the attribute is ignored.

I think the help file states that. Wish I had some more info for ya.

-CJ


Daylor said:
well , the important thing i want to know :

in code the thread.currentthread.apartmentstate is STA , (when i read the
value)
now, as i said, i dont use com object in that thread.

this thread is actcually running in STA ?
cause i can see other thread's can access objects created by the this
thread,
and its not act like STA.

what wrong here ?

object
 
Back
Top