子窗体与主窗体的问题
C#入门经典里面的,我按照上面的抄的,还是有错误,不知道咋的.请问该如何改啊,谢谢!!! 我用的是VS2005.
这是一个建立MDI的例子:
//这是子窗体的源代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace P355
{
public partial class frmChild : Form
{
public frmChild()
{
InitializeComponent();
//Set the parent of the form to the container
this.MdiParent = Parent; //这里提示"Error 14 Cannot implicitly convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.Form'. An explicit conversion exists (are you missing a cast?)"
}
private void frmChild_Load(object sender, EventArgs e)
{
}
}
}
//这是主窗口代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace P355
{
public partial class mdiBasic : Form
{
public mdiBasic()
{
InitializeComponent();
//Create a new instance of the child form
mdiBasic.frmChild child = new mdiBasic.frmChild(this); //这里提示"Error 13 The type name 'frmChild' does not exist in the type 'P355.mdiBasic'
//Show the form
child.Show();
}
private void frmContainer_Load(object sender, EventArgs e)
{
}
}
}