代码Dim NewMdiChild As New MDIChildForm部分提示:未定义类型MDIChildForm
Imports System.Windows.Forms
Public Class Main
Private Sub ExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
If MessageBox.Show( "您确定要离开吗? ", "请确认 ", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
Private Sub FNewToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FNewToolStripMenuItem.Click
Dim NewMdiChild As New MDIChildForm
NewMdiChild.mdiparent = Me
NewMdiChild.show()
End Sub
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
代码Dim NewMdiChild As New MDIChildForm部分提示:未定义类型MDIChildForm
这是为什么?能详细讲讲吗?
谢谢~
[解决办法]
设置它的MdiParent 属性来使窗体成为Mdi子窗体:
Dim NewMdiChild As New Form
NewMdiChild.MdiParent =Me
[解决办法]
MDIChildForm不是一个类型,你不能用new来建立一个类型为MDIChildForm的实例,
除非你定义了这样一个类.
如果说Mdi子窗体是一个类型的话,只能说它是Form类型的.
它可以表现为一个MdiParent的子窗口,就是通过设置MdiParent属性来得到的.