我想同时单击表单 2 中的按钮和表单 1 中的按钮。
如果有人可以为此提出任何想法,那将非常有帮助。提前致谢!
这是我的代码
表格 2
public partial class Form2 : Form
{
Form1 ths;
public Form2(Form1 frm)
{
InitializeComponent();
ths = frm;
button1.Click += new EventHandler(button1_Click);
}
private void button1_Click(object sender, EventArgs e)
{
ths.button1_2= button1;
}
}
表格 1
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
new Form2(this).Show();
}
private void button1_2_Click(object sender, EventArgs e)
{
MessageBox.Show("Dot Net Perls is awesome.");
}
}
我认为这一行有问题,ths.button1_2= button1;
因为我修改了
ths.textBox1.Text = textBox1_2.Text;
但我不知道如何解决它。