Basic Question: Update Parent Window

  • Thread starter Thread starter Jonathan Taylor
  • Start date Start date
J

Jonathan Taylor

I have a form that shows a list of items.

I click a button which opens a child form. On the child form i can create
new items.

How can I refresh the list of items on the parent form ?

I'm not sure how i can trigger an event which will call the refresh on the
parent.

Thanks in advance.
 
Jonathan,

The point is that child form must have a reference to know what form is the
parent form.

You can do that, by example, setting a parameter with the parent form in the
constructor or providing a property in the child form where you could set
this reference. Example:

// Constructor
private YourParentForm mParentForm;
public ChildForm(YourParentForm myParentForm)
{
mParentForm = myParentForm;
}

// or Property
public YourParentForm ParentForm
{ set {mParentForm = value;} }

So, in the child form, you can perform any method provided by the Parent Form.

mParentForm.UpdateSomething();

Cheers,

Francisco.
 
Back
Top