【发布时间】:2012-06-04 10:40:40
【问题描述】:
在 VB.NET 中需要一些帮助,不知道我哪里做错了
背景:我有一个使用 SplitContainer 控件的主窗体。拆分的PANEL1带有MenuStrip,Panel2用于调用相关的外部表单
代码(见下文):函数ResetSplitContainerPanel2清除Panel2并使用SetFormAttributesToLoadInPanel2加载新表单
问题: 虽然SettingSplitContainer.Panel2.Controls.Clear() 清除了Panel2 但表单仍将表单保持在可编辑模式。如果我再次调用相同的表单,我可以看到我之前输入的值
预期输出:在加载新表单时,PANEL2 中先前加载的表单应完全处理
Private Sub ResetSplitContainerPanel2()
SettingSplitContainer.Panel2.Controls.Clear()
End Sub
Private Function SetFormAttributesToLoadInPanel2(ByVal formNameToChange As Form) As Boolean
On Error GoTo errHandler
formNameToChange.IsMdiContainer = False
formNameToChange.ShowInTaskbar = False
formNameToChange.FormBorderStyle = Windows.Forms.FormBorderStyle.None
formNameToChange.ControlBox = False
formNameToChange.TopLevel = False
formNameToChange.Text = ""
formNameToChange.Visible = True
formNameToChange.Width = SettingSplitContainer.Panel2.Width
formNameToChange.Height = SettingSplitContainer.Panel2.Height
SetFormAttributesToLoadInPanel2 = False
Exit Function
errHandler:
MsgBox("Error Description: " & Err.Description, vbOKOnly, "Error")
SetFormAttributesToLoadInPanel2 = True
Exit Function
End Function
感谢您的帮助
【问题讨论】:
标签: vb.net