View Full Version : VS2005 upgrade of VB app with MP control fails with GPF "ActiveX Ctrl...not in a STA"

11-23-2006, 02:47 PM
After converting a VS2003 VB Winform control to VS2005 which has a MapPoint control embedded in it I am now getting runtime exception

"ActiveX control '8f78d7fc-bae4-46a4-a79a-052356ab3dd4' cannot be instantiated because the current thread is not in a single-threaded apartment.".

My app contains a Windows.Forms.UserControl class with MapPoint control embedded on it and a test form I use to develop and debug the UserControl. I tried tagging the Sub Main with <STA...> attribute as per MSDN article with no success.

When I embed the usercontrol in my ASPX page it just crashes the page.

This usercontrol is intended to be accessed embedded in an ASP.NET page via IE7.

I'm stuck.

11-24-2006, 12:24 PM

You cannot access GUI components from another thread than the main thread. It never been, but in earlyer dotNet versions there was no exception generated.