This is very easy stuffs. Please try with that,
you need to write this code on the Button click event in FormA. And txtB is the text of FormB where as txtA is the text box of FormA.
private void btnOK_Click(object sender, EventArgs e)
{
FormB frmB = new FormB();
DialogResult result= frmB.ShowDialog();
if (result == DialogResult.Cancel)
{
this.txtA.Text = frmB.txtB.Text;
}
}
Here you need to make the access modifier of txtB is public. That is,
public System.Windows.Forms.TextBox txtB;