Home All Groups Group Topic Archive Search About

Enabling STAThreadAttribute

Author
8 May 2006 10:07 AM
Adam Honek
How would I enable STAThreadAttribute in my Main function.

I assume the error means Sub Main().

Apparently this may fix my openfiledialog error so it's worth a go.

Thanks,
Adam

Author
8 May 2006 10:17 AM
Adam Honek
I've solved this now sorry, this thread may be deleted.

Adam

Show quoteHide quote
"Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> wrote in message
news:OubnycocGHA.4108@TK2MSFTNGP03.phx.gbl...
> How would I enable STAThreadAttribute in my Main function.
>
> I assume the error means Sub Main().
>
> Apparently this may fix my openfiledialog error so it's worth a go.
>
> Thanks,
> Adam
>
Author
8 May 2006 4:17 PM
Herfried K. Wagner [MVP]
"Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> schrieb:
> I've solved this now sorry, this thread may be deleted.

I'd still try to determine the reason for 'MTAThread' being used.  Are you
using any old COM components within your application?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
8 May 2006 6:36 PM
Adam Honek
Old as in?

It's all .NET 2.0 as far as I can tell.

The only "older" components that possibly use COM and are on my forms are

TreeView
ListView
StatusLabel
RichTextBox
Timer

I didn't set 'MTAThread' by default, this seems to be the default setting
when a
thread is launched in the application.

Adam

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:OMtlXrrcGHA.3632@TK2MSFTNGP02.phx.gbl...
> "Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> schrieb:
>> I've solved this now sorry, this thread may be deleted.
>
> I'd still try to determine the reason for 'MTAThread' being used.  Are you
> using any old COM components within your application?
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>