表单加载时出现奇怪的错误 [英] weird error upon form loading

查看:86
本文介绍了表单加载时出现奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有一些表格。当我加载form1(启动)所有是

罚款,然后我打开另一个并使用登录屏幕再打电话给另一个和

一切都还好,但是当我尝试从第3个表单打开另一个表单时,

它在表单1上给出了这个错误


未处理的类型''System.NullReferenceException异常''发生在

未知模块。


附加信息:对象引用未设置为对象的实例。

但表格已经打开,但程序崩溃了......


继承人我打开表格的方式:


Dim frm As New OldBrackets

关闭()

frm.Show()


我很困惑所以任何帮助都很棒

解决方案

iwdu15写道:

我的项目中有一些表格。当我加载form1(启动)所有是
罚款,然后我打开另一个并使用登录屏幕呼叫另一个和
所有仍然没有,但是当我尝试打开另一个表格时第三种形式,
它在form1上给出了这个错误


未知模块中发生了'System.NullReferenceException'类型的未处理异常。

附加信息:对象引用未设置为对象的实例。

表单已打开,但程序刚崩溃...

继承人我打开表格的方式:

昏昏欲睡的新旧棒子
关闭()
frm.Show()

我很困惑所以任何帮助都是awsome



我认为这就是正在发生的事情....


Dim frm As New OldBrackets< - 创建一个新的表单存储它in frm

关闭()< - 关闭当前表格及其所有变量,包括frm

frm.Show()< - frm re re租了,现在你得到了你的错误。


也许试试:

Dim frm As New OldBrackets

frm.Show()

关闭()


" iwdu15" < IW **** @ discussions.microsoft.com> schrieb

我的项目中有一些表格。当我加载form1(启动
)一切都很好,然后我打开另一个并使用登录屏幕来打电话给另一个,所有仍然很好,但是当我尝试打开
第三种形式的另一种形式,它在form1上给出了这个错误

未知模块中发生了'System.NullReferenceException'类型的未处理异常。

附加信息:对象引用未设置为对象的实例。

表单已打开,但程序刚崩溃...

继承人我怎么打开表格:

昏昏欲睡的新老朋友
关闭()
frm.Show()

我很困惑所以任何帮助都很棒



抛出错误的行是什么?当发生

错误时,请发布callstack(菜单调试 - > windows - > callstack)。

Armin


"克里斯" < no@spam.com> schrieb

iwdu15写道:

我的项目中有一些表格。当我加载form1(启动
)一切都很好,然后我打开另一个并使用登录屏幕
打电话给另一个,一切都还好,但是当我尝试
时从第3个表单打开另一个表单,它在表单1上给出了这个错误

在未知模块中发生未处理的类型''System.NullReferenceException''
的异常。

附加信息:对象引用未设置为对象的实例。

表单已打开,但程序刚崩溃...

继承人我怎么打开表格:

昏昏欲睡的新老朋友
关闭()
frm.Show()

我很困惑所以任何帮助都很棒

我认为这就是正在发生的事情....

Dim frm As New OldBrackets< - 创建一个新的表单存储在frm中/>关闭()< - 关闭当前表单及其所有变量,包括frm
frm.Show()< - frm已经发布,现在你得到哟你的错误。



这是不对的。关闭表单,即相应的窗口,

没有别的。 frm是一个局部变量,仍然保持对新的

表单的引用,因此在关闭表单后frm不是Nothing而且frm.show不能

抛出异常 - 可能在其中一个子程序中,但不是因为

frm什么都没有。

Armin


也许试试:
Dim frm As New OldBrackets
frm.Show()
关闭()




hi, i have a few forms in my project. when i load form1 (startup for) all is
fine, then i open another one and use a login screen to call yet another and
all is still fine, but then when i try to open another form from a 3rd form,
it gives this error on form1

"An unhandled exception of type ''System.NullReferenceException'' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome

解决方案

iwdu15 wrote:

hi, i have a few forms in my project. when i load form1 (startup for) all is
fine, then i open another one and use a login screen to call yet another and
all is still fine, but then when i try to open another form from a 3rd form,
it gives this error on form1

"An unhandled exception of type ''System.NullReferenceException'' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome


I think this is what is happening....

Dim frm As New OldBrackets <- Create a new form store it in frm
Close() <- Close current form and all it''s variables including frm
frm.Show() <- frm has been released, now you get your error.

Maybe try:
Dim frm As New OldBrackets
frm.Show()
Close()


"iwdu15" <iw****@discussions.microsoft.com> schrieb

hi, i have a few forms in my project. when i load form1 (startup
for) all is fine, then i open another one and use a login screen to
call yet another and all is still fine, but then when i try to open
another form from a 3rd form, it gives this error on form1

"An unhandled exception of type ''System.NullReferenceException''
occurred in Unknown Module.

Additional information: Object reference not set to an instance of
an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome


What is the line throwing the error? Please post the callstack when the
error occurs (menu debug -> windows -> callstack).
Armin


"Chris" <no@spam.com> schrieb

iwdu15 wrote:

hi, i have a few forms in my project. when i load form1 (startup
for) all is fine, then i open another one and use a login screen
to call yet another and all is still fine, but then when i try to
open another form from a 3rd form, it gives this error on form1

"An unhandled exception of type ''System.NullReferenceException''
occurred in Unknown Module.

Additional information: Object reference not set to an instance of
an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome

I think this is what is happening....

Dim frm As New OldBrackets <- Create a new form store it in frm
Close() <- Close current form and all it''s variables including frm
frm.Show() <- frm has been released, now you get your error.


This is not right. Close closes the form, i.e. the corresponding window,
nothing else. frm is a local variable and still holds a reference to the new
Form, thus frm is not Nothing after closing the form and frm.show can not
throw the exception - maybe within one of the sub procedures but not because
frm is nothing.
Armin

Maybe try:
Dim frm As New OldBrackets
frm.Show()
Close()




这篇关于表单加载时出现奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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