110,538
社区成员
发帖
与我相关
我的任务
分享
private void Button1_Click(object sender,EventArgs e){Form2 f2=new Form2();f2.Show();}
private void Button2_Click(object sender,EventArgs e){把Form2的TextBox2的内容,传递回主窗体Form1的TextBox1里}
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2(this);
frm2.Owner = this;
frm2.Show();
}
public Form2(Form1 frmM)
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 frmM = (Form1)this.Owner;
frmM.textBox1.Text = this.textBox2.Text;
}
public string TB1
{
get { return textbox1.text; }
set { textbox1.text = value; }
}
Form2 nextForm1 = new Form2();
nextForm1.Owner = this;
nextForm1.ShowDialog();
Form1 fatherForm = (Form1)this.Owner;
Form1.TB1=this.textbox2.text;
public delegate void FindResult(String text);
public event FindResult ResultFinded;
private void button1_Click(object sender, EventArgs e)
{
string qustring = this.textBox1.Text;
SendFindInfo(qustring);
}
private void SendFindInfo(string query,ref int pos)
{
if (ResultFinded != null)
{
ResultFinded(query);
}
}
主窗体
private void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.ResultFinded += new Form2.FindResult(frm_ResultFinded);
frm.Show();
}
void frm_ResultFinded(string text)
{
this.textBox1.text= text;
}