VB.NET 求助(2)
我用VS.NET 2003中的VB.NET建了个windows应用程序,建了两个窗体,一个是Form1把它设置为MDI父窗体,Form2为普通窗体
启动项目的时候form1和form2同时显示出来,但form2在form1上面。
当form2没被关闭,form1不能操作。
使用以下代码
Dim f As Form2
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
f = new Form2()
f.visible = true
End Sub
在form2的失去焦点事件中让form2获得焦点
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
if not f is nothing then
f.focus()
end if
End Sub
当我再次调出form2时,出现以下报错:
未处理的“System.ObjectDisposedException”类型的异常出现在 system.windows.forms.dll 中。
其他信息: 无法访问名为“frmFunctionPanel”的已处置对象。
请问该如何消除这个错误!