c# multiple forms communication
-
greetings, i have 3 forms that need to communicate with each other. what is the best way of achieving this? at present im considering using delegates. your comments are welcome. my app is c# windows forms.
You can use delegate, events or static. I recommend you use static class if app is not Multi-Thread.
public static settings
{
// No constructor
public static String Info;
}with this class you must use directly not initialize it.
Form1_OnLoad(Object sender, EventArgs e)
{
settings.Info = "I have set this text to static member of settings class";
} -
greetings, i have 3 forms that need to communicate with each other. what is the best way of achieving this? at present im considering using delegates. your comments are welcome. my app is c# windows forms.
-
greetings, i have 3 forms that need to communicate with each other. what is the best way of achieving this? at present im considering using delegates. your comments are welcome. my app is c# windows forms.
If it is a one way communication (i.e. from parent to child) you may consider adding an overloaded constructor. If you want 2 way communication, then delegates would be useful. By the way, what kind of a communication you are talking about ? What objects would be passed to and fro ? Details would be great. Thanks !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder