Home All Groups Group Topic Archive Search About

How to run a form in it's own thread in vb.net 2005

Author
2 Mar 2006 1:46 AM
1388-2/HB
Public Sub ThreadStartPoint

    Application.Run(frmSomeForm)

End Sub

This 2003 code no longer works.  What's the new model for accomplishing this
task in vb.net 2005?

Author
2 Mar 2006 6:29 AM
Mattias Sjögren
>Public Sub ThreadStartPoint
>
>    Application.Run(frmSomeForm)
>
>End Sub
>
>This 2003 code no longer works.  What's the new model for accomplishing this
>task in vb.net 2005?


Have you set the thread's ApartmentState property to STA?


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
2 Mar 2006 8:57 PM
1388-2/HB
This was just a stupid mistake

"Application.Run"

was by default referencing My.Application.Run

I just needed to specify System.Windows.Forms.Application.Run.  I was
referencing the Run method of the wrong Application object.

Show quoteHide quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:%23URT1LcPGHA.2176@TK2MSFTNGP10.phx.gbl...
> >Public Sub ThreadStartPoint
>>
>>    Application.Run(frmSomeForm)
>>
>>End Sub
>>
>>This 2003 code no longer works.  What's the new model for accomplishing
>>this
>>task in vb.net 2005?
>
>
> Have you set the thread's ApartmentState property to STA?
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.