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

后端 未结 4 2050
予麋鹿
予麋鹿 2021-01-22 20:54

I am getting this error when i try to show a form with an webbrowser in it.

ActiveX control \'8856f961-340a-11d0-a96b-00c04fd705a2\' cannot be instantiated becau

4条回答
  •  悲哀的现实
    2021-01-22 21:40

    Assuming that you are not using the application framework, you need to decorate your Sub Main with the STAThread attribute.

    For example:

     _
    Public Sub Main()
    

    VB Applications that use the application framework do not have to worry about this attribute since the compiler will apply it automatically.

提交回复
热议问题