System.InvalidCastException [英] System.InvalidCastException

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

问题描述

我已经从vb6转换了我的程序

在initializecomponent事件中,以下代码给出了异常

CType(Me.controlname,System.ComponentModel.ISupportInitialize).EndInit ()

类型为System.InvalidCastException的异常第一次机会在

system.windows.forms.dll


附加信息:不支持Cast。

出了什么问题?我正在使用带有框架1.0 sp3的vsnet2002。

我怎么能把这个异常带走

I have converted my program from vb6
In the initializecomponent event the following code give a n exception
CType(Me.controlname, System.ComponentModel.ISupportInitialize).EndInit( )
Exception first-chance of type "System.InvalidCastException" in
system.windows.forms.dll

Additional information: Cast not supported.
what''s wrong? I am using vsnet2002 with framework 1.0 sp3.
how can i take this exception away

推荐答案

" ; DavideR" <沓***** @ discussions.microsoft.com> schrieb
"DavideR" <Da*****@discussions.microsoft.com> schrieb
我已经从vb6转换了我的程序
在initializecomponent事件中,下面的代码给出了一个
异常CType(Me.controlname,
System.ComponentModel.ISupportInitialize) .EndInit()异常
类型为System.InvalidCastException的第一次机会在
system.windows.forms.dll

附加信息:不支持Cast。
有什么问题?我正在使用带有框架1.0 sp3的vsnet2002。
我怎么能把这个异常带走
I have converted my program from vb6
In the initializecomponent event the following code give a n
exception CType(Me.controlname,
System.ComponentModel.ISupportInitialize).EndInit( ) Exception
first-chance of type "System.InvalidCastException" in
system.windows.forms.dll

Additional information: Cast not supported.
what''s wrong? I am using vsnet2002 with framework 1.0 sp3.
how can i take this exception away




Me.controlname的类型是什么?它是继承自哪个类?

Armin



What is the type of Me.controlname? Which class(es) is it inherited from?
Armin


Armin,


你有没有?知道有一个简单的解决方案来帮助解决投射问题。


您应该尝试一次,在程序顶部设置Option Strict On


:-)

Cor
Armin,

Did you know that there is a simple solution to help with cast problems.

You should try it once, set Option Strict On in top of your program

:-)

Cor


" Cor Ligthert [MVP]" <无************ @ planet.nl> schrieb
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb
Armin,

你知道有一个简单的解决方案来帮助解决问题。

你应该试一试一次,在你的程序顶部设置Option Strict On

: - )
Armin,

Did you know that there is a simple solution to help with cast
problems.

You should try it once, set Option Strict On in top of your program

:-)



啊,真的吗?很高兴知道!


;-)

Armin


Ah, really? Good to know!

;-)
Armin


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

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