Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error handling question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00388620
Message ID:
00388675
Views:
13
>In my application, I have a global error handler that traps the most 'common' types of errors. This code resides in my start-up program.. However, for any other errors, I'd like to inform the user that an unexpected error has occured (I know how to do this) and then close all open tables, databases and forms before exiting the application.
>
>Question, what is a good method for determining the open forms and open databases, tables and cursors - and then closing them?
>
>Thanks.

To close all the forms, I do the following:
if type("_screen.activeform") = "O"
   if _screen.activeform.windowtype = 1   && modal form
      return
   endif
endif
local lnFCount
lnFCount = _screen.FormCount
for i = 1 to lnFCount
   if type("_screen.ActiveForm") = "O"
      if upper(_screen.ActiveForm.BaseClass) = "FORM"
         _screen.ActiveForm.QueryUnload()
      else
         release _screen.ActiveForm
      endif
   endif
endfor
If I am quitting the app, I also do the following:
clear events
oApp.Release()
oMeta.Release()
on shutdown
set procedure to
set sysmenu to default
on error
on escape
set escape on
wait clear
close tables all
close database
return
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform