webbrowser control on form2 vb windows application

Posted by user228058 on Stack Overflow See other posts from Stack Overflow or by user228058
Published on 2009-12-09T15:33:19Z Indexed on 2010/05/29 11:02 UTC
Read the original article Hit count: 563

Hi,

I have a vb windows application with 2 forms, where form2 is called from form1 using form2.showdialog()

I added a web browser control to form2, and I'm getting the following error at the point where form2 is called:

Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.

I tried: 1) adding STAThread() to the form_load() 2) I added a module to my application, and created a sub main(), with the STAThread attribute applied to it 3) I marked the sub startup() with STAThread()

And none of this helped.

Any tips on how to get around this issue?

Thanks, rcpg

© Stack Overflow or respective owner

Related posts about vb

Related posts about webbrowser-control