0

ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.

Im getting this error every time my program tries to initalize the users nasme, and im not sure how to fix it.
I looked a bit on Google, but I couldnt find a solution that was relevant to the actual background worker tool, it was all about actually creating a new thread at runtime, and making it a single thread, which is fine, but I want to do that to my current baackground worker created in design time.

In my main form, I have a button, that starts a timer, on the timer, it calls a background worker, and in that background workers "Do Work" event, it looks inside a class file, that runs this line:
nick = Form1.memberNick.Text
That line is where the error occurs on, and "nick" is a String publically declared within that class file.

If there is any other information you need, please let me know.

2
Contributors
1
Reply
7
Views
3 Years
Discussion Span
Last Post by cgeier
0

This can happen with improper usage of backgroundworker. You can use properties and/or constructors to pass data to your class.

I'm confused. Can you post your code. Or portions of your code that include the relavent information.

Edited by cgeier

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.