以打开修改密码change_the_password为例:
private void t10chapwd_Click(object sender, EventArgs e)
{
//关闭其他窗口
FormCollection childCollection = Application.OpenForms;
for (int i = childCollection.Count; i-- > 0;)
{
if (childCollection[i] != this)
childCollection[i].Close();
else
break;
}
this.IsMdiContainer = true;
change_the_password chapwd = new change_the_password();//创建对象chapwd,并负责给它
chapwd.MdiParent = this;//this新窗口的父窗口
chapwd.userno3 = userno1;//传参
chapwd.WindowState = FormWindowState.Maximized;//窗口最大化
chapwd.Show();//窗口显示
}