c# 问题(求大神们帮助)
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
但是 这个代码 放在那里?
这是MFC板块 你题错了吧
页:
[1]