Link to home
Start Free TrialLog in
Avatar of BeckyBusch
BeckyBusch

asked on

Ending a VB program

Problem:
I am using VB6.0 as my developing environment.  I am unable to properly end my program on a clean 95 machine. I get the error: "dmsUser caused an invalid page fault in module MFAC42.dll"
My thoughts:
I had thought that I wasn't unloading all forms, but this did not solve the problem.  I also thought I wasn't hitting the end.  But the error seems to occur when I hit the "END"
Has anyone had a problem like this?  What did you do to fix it??  This error only occurs on Windows 95 machines, where VB is not loaded.
Thanks in advance.
Avatar of roverm
roverm
Flag of Netherlands image

Do you use the DataReport Designer ?
Avatar of BeckyBusch
BeckyBusch

ASKER

No we do not use the DataReport Designer
This may or may not solve all your problems but you should never use End to terminate your program.  Unload your forms and set them to nothing.
You should also explicitly destroy all object variables and close any connections to files or databases.
I do unload all forms, and set the main form = nothing.  I also close my connections to the DB.  Should I set all forms = nothing?
try doing
dim f as form
for each f in forms
   if f.hwnd <> me.hwnd then    
       unload f
       set f= nothing
   end if
next f
unload me

this will unload all other forms before yours.
dunno if it will solve ur prob though
ASKER CERTIFIED SOLUTION
Avatar of pmwood
pmwood

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
Thank you for your help.. I am building with a MFC42.dll, and the 95 machine has a 4.2 version of the MFC42.dll
Thanks again!