vb.net Windows调用表单问题 [英] vb.net windows calling a form problem
本文介绍了vb.net Windows调用表单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从MDI表单调用一个表单,但是它显示对象引用未设置为对象实例".我的代码如下:
I''m calling from MDI form to a form but it is showing "object reference not set to an instance of object". My code is given below:
Private Sub btnNewAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewAdd.Click
Dispose()
frmAddCustomer.ShowDialog()
End Sub
推荐答案
我看到Dispose()
方法出现在frmAddCustomer.ShowDialog()
的前面.这意味着,在运行frmAddCustomer.ShowDialog()
之前,将清除所有资源.这意味着没有控件具有初始化,这导致错误object reference not set to an instance of object
.
请删除Dispose()
方法
I seeDispose()
method appears in front offrmAddCustomer.ShowDialog()
. It means that, all Resources will be cleared before running intofrmAddCustomer.ShowDialog()
. It means there is no control has initialization, this cause to the errorobject reference not set to an instance of object
.
Please removeDispose()
method
Private Sub btnNewAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewAdd.Click
'Dispose()
frmAddCustomer.ShowDialog()
End Sub
这篇关于vb.net Windows调用表单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文