简体   繁体   English

多个C#Windows窗体应用程序

[英]multiple c# windows form application

I have two forms, the main form and a form named FrmSteg. 我有两种形式,主要形式和名为FrmSteg的形式。 I added a button on the main form and entered the code below in the click event of the button.But i got an error "Only assignment, call, increment, decrement, and new object expressions can be used as a statement" 我在主窗体上添加了一个按钮,并在该按钮的click事件中输入了以下代码。但是我收到一个错误“只能将赋值,调用,递增,递减和新的对象表达式用作语句”

private void btnsteg_Click(object sender, EventArgs e)
{
    FrmSteg newForm = new FrmSteg();
    newForm.Show;
    this.Hide; 
}

Try this: 尝试这个:

newForm.Show();
this.Hide();

You forgot the () behind the method call: 您忘记了方法调用背后的()

newForm.Show();
this.Hide();

If the new form is supposed to be used as kind of a dialog, use ShowDialogue(newForm); 如果应该将新表单用作对话框的一种,请使用ShowDialogue(newForm); This will "lock" your main form until the new form has been closed. 这将“锁定”您的主表单,直到关闭新表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM