例外 [英] exception

查看:104
本文介绍了例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要帮助


i在我的项目中出现此错误:

"'System.Threading.ThreadStateException''类型未处理的异常/>
发生在system.windows.forms.dll

附加信息:无法实例化ActiveX控件

''648a5600-2c6e-101b-82b6-000000000014 ''因为当前的帖子不在

a单线程公寓里。


这一行:

这个。 axMSComm1 =新的AxMSCommLib.AxMSComm();


,但是如果我用一个表单创建新项目并把这个mscomm32.ocx

它的工作效果很好我可以从com1获取数据。

有什么问题?


谢谢

解决方案

只是一个简单的想法...


你错过了吗?[STA Thread]"你的Main()方法中的行?

[STAThread]

static void Main()

{

申请.Run(新Form1());

}


ShaneB


" Itzik" <它**** @ pisgasys.co.il>在消息中写道

news:uv ************** @ TK2MSFTNGP09.phx.gbl ...

需要帮助

我的项目中出现此错误:
system.windows.forms.dll中发生了'System.Threading.ThreadStateException'类型未处理的异常

附加信息:无法实例化ActiveX控件
''648a5600-2c6e-101b-82b6-000000000014'',因为当前线程不是单线程单元中的
。 />
这一行:
this.axMSComm1 = new AxMSCommLib.AxMSComm();

,但如果我使用一个表单创建新项目并将此mscomm32.ocx <这是好的工作,我可以从com1获取数据。
有什么问题?



我正在使用这个

[STAThread]


static void Main()


{


Application.Run(new FrmDataEntryWeighing());


}

" ShaneB" < ST ******** @ yahoo.com>在消息中写道

新闻:uD ************** @ TK2MSFTNGP15.phx.gbl ...

快速思考。 ..

你错过了吗?[STA Thread]"你的Main()方法中的行?
[STAThread]
static void Main()
{Application / Run(new Form1());
}

ShaneB

Itzik <它**** @ pisgasys.co.il>在消息中写道
新闻:uv ************** @ TK2MSFTNGP09.phx.gbl ...

需要帮助
我的项目中出现此错误:
system.windows.forms.dll中发生类型'System.Threading.ThreadStateException'的未处理异常

其他信息:可能没有实例化ActiveX控件
''648a5600-2c6e-101b-82b6-000000000014''因为当前线程不是单线程单元中的。

这一行:
this.axMSComm1 = new AxMSCommLib.AxMSComm();

,但如果我用一个表单创建新项目并把它放到mscomm32.ocx
它工作得很好,我可以从com1获取数据。
有什么问题?

谢谢




更多信息:

此表格不是我的开始表格。

" ShaneB" < ST ******** @ yahoo.com>在消息中写道

新闻:uD ************** @ TK2MSFTNGP15.phx.gbl ...

快速思考。 ..

你错过了吗?[STA Thread]"你的Main()方法中的行?
[STAThread]
static void Main()
{Application / Run(new Form1());
}

ShaneB

Itzik <它**** @ pisgasys.co.il>在消息中写道
新闻:uv ************** @ TK2MSFTNGP09.phx.gbl ...

需要帮助
我的项目中出现此错误:
system.windows.forms.dll中发生类型'System.Threading.ThreadStateException'的未处理异常

其他信息:可能没有实例化ActiveX控件
''648a5600-2c6e-101b-82b6-000000000014''因为当前线程不是单线程单元中的。

这一行:
this.axMSComm1 = new AxMSCommLib.AxMSComm();

,但如果我用一个表单创建新项目并把它放到mscomm32.ocx
它工作得很好,我可以从com1获取数据。
有什么问题?

谢谢




need help

i Have this error in my project:
"An unhandled exception of type ''System.Threading.ThreadStateException''
occurred in system.windows.forms.dll
Additional information: Could not instantiate ActiveX control
''648a5600-2c6e-101b-82b6-000000000014'' because the current thread is not in
a single-threaded apartment."

on this row :
this.axMSComm1 = new AxMSCommLib.AxMSComm();

, but if i create new project with one form and put this mscomm32.ocx
it is work thery good and i can get data from com1.
what is the problem ?

Thanks

解决方案

Just a quick thought...

Are you missing "[STA Thread]" line in your Main() method?
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

ShaneB

"Itzik" <it****@pisgasys.co.il> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...

need help

i Have this error in my project:
"An unhandled exception of type ''System.Threading.ThreadStateException''
occurred in system.windows.forms.dll
Additional information: Could not instantiate ActiveX control
''648a5600-2c6e-101b-82b6-000000000014'' because the current thread is not
in
a single-threaded apartment."

on this row :
this.axMSComm1 = new AxMSCommLib.AxMSComm();

, but if i create new project with one form and put this mscomm32.ocx
it is work thery good and i can get data from com1.
what is the problem ?

Thanks



i am using this
[STAThread]

static void Main()

{

Application.Run(new FrmDataEntryWeighing());

}
"ShaneB" <st********@yahoo.com> wrote in message
news:uD**************@TK2MSFTNGP15.phx.gbl...

Just a quick thought...

Are you missing "[STA Thread]" line in your Main() method?
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

ShaneB

"Itzik" <it****@pisgasys.co.il> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...

need help

i Have this error in my project:
"An unhandled exception of type ''System.Threading.ThreadStateException''
occurred in system.windows.forms.dll
Additional information: Could not instantiate ActiveX control
''648a5600-2c6e-101b-82b6-000000000014'' because the current thread is not
in
a single-threaded apartment."

on this row :
this.axMSComm1 = new AxMSCommLib.AxMSComm();

, but if i create new project with one form and put this mscomm32.ocx
it is work thery good and i can get data from com1.
what is the problem ?

Thanks




more information:
this form is not my start form.
"ShaneB" <st********@yahoo.com> wrote in message
news:uD**************@TK2MSFTNGP15.phx.gbl...

Just a quick thought...

Are you missing "[STA Thread]" line in your Main() method?
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

ShaneB

"Itzik" <it****@pisgasys.co.il> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...

need help

i Have this error in my project:
"An unhandled exception of type ''System.Threading.ThreadStateException''
occurred in system.windows.forms.dll
Additional information: Could not instantiate ActiveX control
''648a5600-2c6e-101b-82b6-000000000014'' because the current thread is not
in
a single-threaded apartment."

on this row :
this.axMSComm1 = new AxMSCommLib.AxMSComm();

, but if i create new project with one form and put this mscomm32.ocx
it is work thery good and i can get data from com1.
what is the problem ?

Thanks




这篇关于例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆