Firstly, you could simply call Close(); in the richTextBox1_Click event.
Like this:
private void richTextBox1_Click(object sender, EventArgs e)
{
Form3 child = new Form3(textBox1);
child.Show();
Close();
}
Else, and this is my preferred approach, use a class to store all your address information.
public class AddressInfo
{
public string street1 {get;set;};
public string street2 {get;set;};
public string city {get;set;};
public string state {get;set;};
public string country {get;set;};
public string zipcode {get;set;};
public string CompleteAddress()
{
Return string.format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}",
street1, street2, city, state, country, zipcode);
}
}
This class is then made as a public property on Form3 and is populated in your button1_Click event.
Then you change the richTextBox1_Click event to be:
private void richTextBox1_Click(object sender, EventArgs e)
{
Form3 child = new Form3(textBox1);
child.Showdialog();
richTextBox1.Text = child.AddressInfo.CompleteAddress();
}