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
krajnik
Posts
-
Dialogs in Windows Forms application -
Windows Forms Question (C++)I am a relatively new C++ user. I am developing a program to run a control algorithm. Basically what the program does is communicate with an analog I/O card that I have installed. It reads voltage values from the I/O card and uses them to compute and output a control value to a separate channel. I am currently attempting to use windows forms to accomplish this. When I run the program, I want a form to come up that allows me to change control parameters. There will be a "start" button which begins execution of the control algorithm (essentially just a program loop). Then, I want a "stop" button which terminates execution of the control loop. The problem that I'm having is that I can't figure out how to use a Windows Forms button to terminate a program loop. Can anyone offer any suggestions here? Andrew Krajnik