2个回答
展开全部
弹出form2
private void button3_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.Owner = this;
frm.Show();
}
form2里单击添加按钮就写回到form1的textbox1里
private void button1_Click(object sender, EventArgs e)
{
Form1 frm1;
frm1 = (Form1)this.Owner;
frm1.textBox1.Text = textBox1.Text;
}
private void button3_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.Owner = this;
frm.Show();
}
form2里单击添加按钮就写回到form1的textbox1里
private void button1_Click(object sender, EventArgs e)
{
Form1 frm1;
frm1 = (Form1)this.Owner;
frm1.textBox1.Text = textBox1.Text;
}
更多追问追答
追问
不行啊textBox1不可访问,受保护级别的限制啊
追答
textBox1 的Modifier属性设置成public
展开全部
public pritial class Form1:Form
{
public Form1()
{
InitCompoment();
}
public void button1_Click(object sender,EventArgs e)
{
Form2 fm = new Form2();
if (fm.DialogResult == DialogResult.OK)
{
this.label.Text = fm.tbText.Text;
}
}
}
{
public Form1()
{
InitCompoment();
}
public void button1_Click(object sender,EventArgs e)
{
Form2 fm = new Form2();
if (fm.DialogResult == DialogResult.OK)
{
this.label.Text = fm.tbText.Text;
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询