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.
BeckyBuschAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rovermCommented:
Do you use the DataReport Designer ?
0
BeckyBuschAuthor Commented:
No we do not use the DataReport Designer
0
tkuppinenCommented:
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.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

tkuppinenCommented:
You should also explicitly destroy all object variables and close any connections to files or databases.
0
BeckyBuschAuthor Commented:
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?
0
crazymanCommented:
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
0
pmwoodCommented:
Do you mean mfc42.dll?

Yes or no, he most likely problem is that this version of this DLL on the machine is not compatible with VB6 or some other component you are distributing.

The best solution is to create a setup package on a working machine with the package wizard and run that to install correct versions of all the required files.

A reboot will be required, since windows uses the file.

Because this file is used by the operating system, there may be problems replacing it.  If the setup doesn't work, (thefile is distributed but after running setup the old version is still in place) or you want to try to shortcut the process, you could replace this file with the version from a working machine.  Look at MS knowledge base article Q140570 on their website to find out how to replace a file in use by windows.  

I don't advise the shortcut because DLLs come in sets, and may not work if changed one at a time.  Keep a backup of the current file to go back to.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BeckyBuschAuthor Commented:
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.