Dmitry,
Check out Doug's article on error handling, it my help you out.
http://www.stonefield.com/techpap.htmlI have an global application object, and an error handler object. When an error occurs and the application is supposed to shutdown, the error handler tells the application object to do so. It (the application object) takes care of making sure all forms are closed, cleaning up, and then quitting. There isn't any cleanup code after the READ EVENTS in my main program.
Oh, instead of putting buggy code in your program, you can do error testing by using the ERROR command. That way it would be easier to do a search for ERROR and make sure you haven't left bugs laying around. :)
>Steve,
>
>You are probably right. But what I was trying to simulate is how my program reacts to an error. First I put just a buggy code (undeclared variable) in the middle of the loop. The error manager would get it and issue Clear Events but it was not working. So I am trying to see how to deal with errors generated inside a loop.
>
Steve Gibson