如何打开新表单并隐藏当前打开的表单 [英] how to open a new form and hide the current open form
问题描述
我正在尝试打开一个新表单,当表单打开时,应隐藏当前打开的表单。这里是我正在使用的代码没有语法错误,当我运行它时没有任何反应当我点击按钮。请帮助
private void btnopen_Click(object sender,EventArgs e)
      {
form1 frm = new form1();
                this.Hide();
                  frm.Show();
}
msdn account collohdicey
祝你这个帮助
检查
this.btnopen.Click + = new System.EventHandler(this.btnopen_Click);在Form的Designer.cs文件中
否则添加在Form的构造函数中的InitializeComponent之后相同
public YourForm()
{
InitializeComponent();
this.btnopen.Click + = new System.EventHandler(this.btnopen_Click);
}
I am trying to open a new form and when the form opens the currently opened form should be hidden. here is the code i am using which has no syntax error and when i run it nothing happens when i click the button.please help
private void btnopen_Click(object sender, EventArgs e){
form1 frm = new form1();
this.Hide();
frm.Show();
}
msdn account collohdicey
May This Help You
Check for
this.btnopen.Click += new System.EventHandler(this.btnopen_Click);in Form's Designer.cs file
else add the same after InitializeComponent in Form's Constructor
public YourForm() { InitializeComponent(); this.btnopen.Click += new System.EventHandler(this.btnopen_Click); }
这篇关于如何打开新表单并隐藏当前打开的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!