How to call methods from previous using delegates?

  • Thread starter Thread starter Ryu
  • Start date Start date
R

Ryu

Hi,

May I know how to call methods from previous form using delegates? Thanks.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top