How to call methods from previous using delegates?

  • Thread starter Thread starter Ryu
  • Start date Start date
Ryu said:
May I know how to call methods from previous form using delegates?

Why not simply keep a reference to this form and call the methods directly?
 
I would like to update a listbox in the previous form. I should have made
myself clear. Sorry.
 
Ryu said:
I would like to update a listbox in the previous form. I should have made
myself clear. Sorry.

First of all, you should let the previous form update its own list box.
Nobody outside of that form should be aware that there happens to be a list
box control on that form.

Instead of exposing, say, a products list box, you should consider exposing
a SetProducts method. That way, the original form can decide to change how
the products are displayed without the second form having to care.

Additionally, be careful about updating UI remotely. Be sure to check the
InvokeRequired property of the form you're changing.

John Saunders
 
Back
Top