VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 307,080 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,249 people online right now. Registration is fast and FREE... Join Now!




Multithreaded Forms

 

Multithreaded Forms, Open existing form on new thread

mishipal

22 Jun, 2009 - 01:38 AM
Post #1

D.I.C Head
**

Joined: 4 May, 2009
Posts: 77



Thanked: 1 times
My Contributions
I wanna open an existing form on a new thread so that one form does not wait for others, as it has to do a lot of work.

CODE

Dim thread As Threading.Thread
            thread = New Threading.Thread(AddressOf Me.showform)
            thread.Start()

CODE

Form2.ShowDialog()


i get an activex error

System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."
Source="Logitex"
StackTrace:
at Logitex.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190 at Logitex.My.MyProject.MyForms.get_Home() at Logitex.Login.showform() in D:\Visual Studio 2005 Projects\Logitex\Logitex\Login.vb:line 81 at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Threading.ThreadStateException
Message="ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.WebBrowserBase..ctor(String clsidString) at System.Windows.Forms.WebBrowser..ctor() at Logitex.Home.InitializeComponent() in D:\Visual Studio 2005 Projects\Logitex\Logitex\Home.Designer.vb:line 140 at Logitex.Home..ctor() in D:\Visual Studio 2005 Projects\Logitex\Logitex\Home.vb:line 49
InnerException:


User is offlineProfile CardPM
+Quote Post



Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 10:33AM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month