开发者

ActiveX control cannot be instantiated because the current thread is not in a single-threaded apartment

开发者 https://www.devze.com 2022-12-13 01:52 出处:网络
As the subject is self explainatory, I need help. I\'m writ开发者_运维百科ing a small tool that displays a splash screen when starting.

As the subject is self explainatory, I need help.

I'm writ开发者_运维百科ing a small tool that displays a splash screen when starting. The splash screen is a Form. When there was only a Button control on it it was working fine. But when I removed it and placed a WebBrowser control on it, it throws the above exception.

Thanks in advance.


Are you using WinForms? If so, try placing the [STAThread] attribute at the top of your class definition and see what happens:

namespace WindowsFormsApplication1 { [STAThread] public partial class Form1 : Form {

0

精彩评论

暂无评论...
验证码 换一张
取 消