Dialogs in Windows Forms application
-
I am having trouble with a Forms application I'm writing. I have 3 forms: a main form, Form1, and two modal dialogs, Forms 2 and 3, that are called from the main form. The two dialogs are intended to change certain "control parameters" that are used by the main form to run a control algorithms. So I need the two dialogs to be able to set certain variables that are used by the rest of hte program. Also, when I open one of hte dialogs, the controls on that from should reflect the current state of those variables. I cannot figure out how to do this. I thought I could declare global variables that could be accessed by all three forms. That way, when I open a dialog, its controls would be set based on the current values of those globals. Then, when I close the dialog and apply the changes, those changes would be saved back to the global variables. I tried this, and I can't seem to define variables that are accessible to all the dialogs. Am I going about this all wrong? Can anyone help guide me in the right direction? ANy help would be greatly appreciated. Andrew Krajnik
-
I am having trouble with a Forms application I'm writing. I have 3 forms: a main form, Form1, and two modal dialogs, Forms 2 and 3, that are called from the main form. The two dialogs are intended to change certain "control parameters" that are used by the main form to run a control algorithms. So I need the two dialogs to be able to set certain variables that are used by the rest of hte program. Also, when I open one of hte dialogs, the controls on that from should reflect the current state of those variables. I cannot figure out how to do this. I thought I could declare global variables that could be accessed by all three forms. That way, when I open a dialog, its controls would be set based on the current values of those globals. Then, when I close the dialog and apply the changes, those changes would be saved back to the global variables. I tried this, and I can't seem to define variables that are accessible to all the dialogs. Am I going about this all wrong? Can anyone help guide me in the right direction? ANy help would be greatly appreciated. Andrew Krajnik