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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.