pass a value from one form to another

后端 未结 7 1169
Happy的楠姐
Happy的楠姐 2020-11-27 21:10

I have two forms, and I need pass a value from form1.textbox1 to form2.variable

Form1:

string Ed = \"\", En = \"\"; 

public string En1
{
    get { r         


        
7条回答
  •  渐次进展
    2020-11-27 21:51

    The debugger doesn't complain about anything? Hm. Maybe you could try to modify your button1_click method in form 1 as follows:

    private void button1_Click(object sender, EventArgs e)
     {
    
        Form2 F2 = new Form2();
        Form2.Parent = this;
        F2.Show();
        F2.textbox1value = F2.Parent.Ed;
        F2.textbox2value = F2.Parent.En;
    }
    

提交回复
热议问题