How to change text in a textbox on another form in Visual C#?

后端 未结 7 2016
抹茶落季
抹茶落季 2020-12-02 01:30

In Visual C# when I click a button, I want to load another form. But before that form loads, I want to fill the textboxes with some text. I tried to put some commands to d

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 01:37

    private void button1_Click(object sender, EventArgs e)
    {    
        Form2 frm = new Form2();
        TextBox txt = (TextBox)frm.Controls.Find("p1c1val", true)[0];
        txt.Text = "foo";
    }
    

提交回复
热议问题