首页 > 解决方案 > 为什么我不能处理表单?

问题描述

我有一个 Windows 窗体应用程序,它有两种形式:Form1 和 Form2。启动窗体是Form1,Form2是通过Button点击加载的。

在我加载 Form1 之后,但在我加载 Form2 之前,这是我得到的:

MsgBox(Form2 Is Nothing) 'returns true
MsgBox(Form2.IsDisposed) 'returns false
MsgBox(Form2 Is Nothing) 'returns false 

Form2.Dispose()
MsgBox(Form2 Is Nothing) 'returns false
MsgBox(Form2.IsDisposed) 'returns false 

Form2.Close()
MsgBox(Form2 Is Nothing) 'returns false
MsgBox(Form2.IsDisposed) 'returns false 

如果我加载 Form2 然后用关闭框关闭它:

MsgBox(Form2 Is Nothing) 'returns false
MsgBox(Form2.IsDisposed) 'returns false 

为什么 Form2 永远不会被处理掉,以及如何完全处理掉它?

标签: .netvb.netwinforms

解决方案


推荐阅读