Error Occuring while opening other form from a threaded form in vb.net
Posted on 2011-02-14
I basically have two forms, ("form1" & "loginform")
Form1 has axwindowsmediaplayer1 (windows media player component)
Loginform consists of two textbox (username, password) and one button1 to process login.
When user press button1, a new thread is created, which logins to mysql database stored online and if login gets successful, i hide current form (me.hide) and show my main form (form1.show).
To my surprise, instead of showing form1 it is throwing exception. here is the error:
"An error occurred creating the form. See Exception.InnerException for details. The error is: ActiveX control '6bf52a52-394a-11d3-b153-00c04f79faa6' cannot be instantiated because the current thread is not in a single-threaded apartment."
So how can i get rid of these error and successfully show my main form??? I don't know whether this error is with visual basic 2008, 2010 or some mistake from my side in improperly coding in vb.net. This project is really important for me and any help will be really very appreciated.