private void btnTrimite_Click(object sender, EventArgs e) { persoanaCurenta = new Persoana(txtNume.Text); //Pas2 : se apeleaza noul constructor al formei FormaDestinatie using (FormaDestinatie frmDest = new FormaDestinatie(persoanaCurenta)) { var dr = frmDest.ShowDialog(this); if (dr == DialogResult.OK) { txtNume.Text = persoanaCurenta.Nume; } frmDest.Close(); } }
//Pas 1: se declara un nou constructor pentru FormaDestinatie care primeste prin referinta un obiect de la forma initiala public FormaDestinatie(Persoana pers) : this() { persFormaSursa = pers; }