Set value to another form

后端 未结 4 1703
清歌不尽
清歌不尽 2021-01-21 12:50

I have to form Form1 and Form2

Form1 source

namespace WindowsFormsApplication1
{
    public partial class Form1 :          


        
4条回答
  •  悲&欢浪女
    2021-01-21 13:32

    In Form2 you have to add a parameter for the Form1.

    i.e.

    // Form1
    ...
    private void button1_Click(object sender, EventArgs e)
    {
        Form2 frm = new Form2(this);
        frm.SetBtn = "teste test";
        frm.Show();
    }
    ...
    
    // Form2
    public Form2(Form frm1)
    {
        InitializeComponent();
        frm1.setLb = "test test";
    }
    

提交回复
热议问题