You don't want to create a
new ParentForm. What you want is to get an instance of the ParentForm that just created the ChildForm.
There are several ways to achive this. Here's the most useful one (IMHO).
ChildForm.cs:
public class ChildForm : Form
{
public event EventHandler ChildWantedSomething;
EventHandler eh = ChildWantedSomething;
if( eh != null)
{
eh(this, new EventArgs());
}
}
ParentForm.cs:
public class ParentForm : Form
{
ChildForm CForm = new ChildForm();
CForm.ChildWantedSomething += SomeMethod;
}
Of course, for this simple variant to work,
SomeMethod needs to have the signature dictated by
EventHandler[
^]. If that's not possible, you can either subscribe another method to the event, made up solely to cal the one you want.
Or you can use a custom delegate other than EventHandler that matches the signature you need.
[Edit]
For reasons not totally clear, here a version that I don't like as much as the one above, without events.
ChildForm.cs:
public class ChildForm : Form
{
private ParentForm _parentForm = null;
public ChildForm(ParentForm parent)
{
_parentForm = parent;
}
_parentForm.SomeMethod();
}
This version links both forms tightly together, which is bad. I hope, whoever put that no-events-restraint on you is aware of what he is imposing on you. If not, chances are that later on, when the drawbacks of this solution are revealed, you get blamed for not doing it right.
Good luck.
[/Edit]