It depends on whether frmChangeUser is modal or not. If it is modal,
just have some properties on frmChangeUser, and after ShowDialog()
simply read them and update. The next preferred option (regardless of
modality) is to have some event(s); at the simplest:
public event EventHandler UserChanged;
on frmChangeUser which you hook from frmMain (immediately after
creating the form), and in the handler you again read the properties
you expose. You can do the same with a custom event signature
(eventargs), but it is extra work for little gain. Another (slightly
messier) way is to pass the frmMain instance to frmChangeUser (for
instance in the ctor), but this is not very reusable, and is against
best practice; the OO principle here is that frmChangeUser knows about
users (and changing them), and frmMain knows about the menu; let
frmMain update itself when frmChangeUser does something note-worthy.
Does that make sense?
Marc
|