Link to home
Start Free TrialLog in
Avatar of stimmis
stimmis

asked on

Exit(0) in "FormActivate" produces exception & error Cannot change Visible in Ohshow or OnHide

I inherited a program that I am now responsible for and in the "TfrmMain::FormActivate" routine there are a few places that check for an instrument alive on the GPIB bus and if its not, an error is displayed and then the code performs an "exit(0)".  When this happens and I'm in the debugger I get the following error message:

"Project RF_CCA_Ttest.exe raised exception class EInvalidOperation with message 'Cannot change Visible in OnShow or OnHide'.  Process stopped.  Use step or Run to Continue."

I am in the FormActivate event procedure not an OnShow or OnHide.  Anyway how can I shut the program down from within the FormActivate event procedure?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Cayce
Cayce
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Right Cayce...
Also any exception raised on debug mode will not be showed at release mode.

gtokas.