标题:子窗体与主窗体的问题
取消只看楼主
MichaelChan
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2006-2-3
 问题点数:0 回复次数:0 
子窗体与主窗体的问题
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)
{

}
}
}
搜索更多相关主题的帖子: 子窗体 using System 源代码 
2006-02-03 12:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-44380-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.895812 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved