For example, there is a form 1 and a form 2, on each form there is a button that opens a third form.

As from the third form to manipulate the elements of the parent form.

Did so. On the first and second form:

Form capture = new capture(); capture.Owner = this; capture.ShowDialog(); 

On the third form:

 add_people main = this.Owner as add_people; 

But here we clearly indicate add_people, and how can we do this without specifying the name of the form?

  • divide the model and the presentation, it's time to judge your question. - rdorn

1 answer 1

Pass the old form to the new constructor and work with it already

The first form:

 Form2 a = new Form2(this); a.Show(); 

Second:

 public partial class Form2 : Form { Form1 a; public Form2(Form1 a) { this.a = a; InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { } private void Form2_MouseClick(object sender, MouseEventArgs e) { a.Width += 5; } } 

Or pass on any other item.