|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
C# 窗口启动时无法启动,from1 加上webbroser1 控件,,结果 出错 ,错误提示是:
当前线程不在单线程单元中,因此无法实例化 ActiveX 控件
这个 问题怎么解决?
网上搜索了 但是 解决方案是:
<MTAThread()> _
Public Sub main()
' Application.Run(Fr1)
' Application.Run(Fr2)
' Application.Run(Fr3)
'Dim MyThread As System.Threading.Thread
'MyThread = New System.Threading.Thread(AddressOf LaunchForm)
'' Specify that the MyThread thread runs in an MTA.
'MyThread.ApartmentState = Threading.ApartmentState.STA
'MyThread.Name = "InfraServiceThread"
'MyThread.Start()
Dim thd As New Thread(New ThreadStart(AddressOf LaunchForm))
thd.SetApartmentState(ApartmentState.STA)
' thd.IsBackground = True
thd.Start()
End Sub
Public Sub LaunchForm()
' Run a standard application message loop on the current thread.
Application.Run(New MainForm)
End Sub
但是 这个代码 放在那里?
|
|