我在窗口表单中有三个按钮可以打开3个不同的表单,但这些表单是打开的,只能由button1
打开。
public partial class Home : Form
{
public Home()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Task addnew = new Task();
addnew.Show();
}
private void button2_Click(object sender, EventArgs h)
{
Task History = new Task();
History.Show();
}
private void button3_Click(object sender, EventArgs v)
{
Task Evaluate = new Task();
Evaluate.Show();
}
}
答案 0 :(得分:1)
如果您的表单名称为Task
,History
和Evaluate
,请在三种方法中初始化您的三个
public partial class Home : Form
{
public Home()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Task addnew = new Task();
addnew.Show();
}
private void button2_Click(object sender, EventArgs h)
{
History history = new History();
history.Show();
}
private void button3_Click(object sender, EventArgs v)
{
Evaluate evaluate = new Evaluate();
evaluate.Show();
}
}