Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2008, 03:17 PM
Registered User
 
Join Date: Nov 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formless class is MTA rather than STA, how do I ma

 While my project is STA when I added a class with no form it is executing in an MTA state. I can't find any reference to MTA or STA anywhere in the entire solution. How do I set a class to run in STA rather than MTA mode?

When I try to instantiate a form object from this class with no form, I get an exception of "control cannot be instantiated because the current thread is not in a single-threaded apartment". When I put <STAThread()> Shared Sub Main() Application.Run, GetApartmentState still says MTA from anywhere in the class and the Main never gets called. From the main form of the project GetApartmentState says STA, so somehow the formless class has been switched into an MTA state while the rest of the project is in an STA state. I also tried turning of the application framework off.






Similar Threads
Thread Thread Starter Forum Replies Last Post
You have an error in your SQL syntax; check the ma JimZippy BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 December 5th, 2007 12:34 PM
Property access from Class within Partial Class zoltac007 C# 2005 0 December 1st, 2006 01:01 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
displayin multiple/same datasets in ma combo box tommyboy1910 Pro VB.NET 2002/2003 0 September 26th, 2005 11:57 PM
How to include c# class and vb class in the .vbprj umeshayk VS.NET 2002/2003 2 January 9th, 2004 12:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.