最好是new前判断是不是要new不过在load里close也没发生错误么,lz 是其他问题吧using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;namespace WindowsApplication58 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.Close(); } } }
{
if 权限不对
xxxx.FormClosed += new FormClosedEventHandler(saveDocument_FormClosed);
xxxx.show();
}void xxxx_FormClosed(object sender, FormClosedEventArgs e)
{
xxxx.FormClosed -= new FormClosedEventHandler(xxxx_FormClosed);
xxxx.Dispose();
xxxx = null;
}
if(1==1)
this.Dispose();
来实现窗体的关闭~~~
{
if (1 == 1)
this.Dispose();
}
思路不好
如果有权限 则打开窗体 如果没有权限 不需要先打开 然后又关闭
if (有权限)
{ newform aa=new newform();// newform 是你要打开的窗体的名称
for (int x = 0; x < this.MdiChildren.Length; x++)
{
Form Childform = (Form)this.MdiChildren[x];
Childform.Close();
}
aa.MdiParent = this;
aa.WindowState = FormWindowState.Maximized;
aa.Show();
}
else//没有权限
{ messagebox.show("没有权限");} 我想我上面的代码对楼主应该有点帮助吧 呵呵
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication58
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); } private void Form1_Load(object sender, EventArgs e)
{
this.Close();
}
}
}