Solved

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

Posted on 2004-10-07
2
654 Views
Last Modified: 2013-11-17
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!
0
Comment
Question by:stimmis
2 Comments
 
LVL 9

Accepted Solution

by:
Cayce earned 500 total points
Comment Utility
Application->Terminate() should do fine.

If it doesn't on your application then you need to close a couple forms before terminating.
0
 
LVL 16

Expert Comment

by:George Tokas
Comment Utility
Right Cayce...
Also any exception raised on debug mode will not be showed at release mode.

gtokas.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deletiā€¦
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now