Winform子窗体关闭给父窗体传值

 //父窗体
   private void btnAdd_Click(object sender, EventArgs e)
        {
            FormAddHotKey m_FormAddKey = new MyAutomaticTextInput.FormAddHotKey();
            m_FormAddKey.Owner = this;
            m_FormAddKey.ShowDialog();
        }
//子窗体
   private void btn_OK_Click(object sender, EventArgs e)
        {
           
            FormAutomaticTextInput m_FormAutomaticTextInput = (FormAutomaticTextInput)this.Owner;           
            m_FormAutomaticTextInput.label2.Text = "123";         
            this.Close();
        }

 

你可能感兴趣的:(Winform)