If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

Closing program trouble.

HY!

My program works with access files *.mdb. Everything is working, but when i push the close button the program close itself, but it remains in memory (i can see this when i press Ctr+Alt+Del). My program is working on WinXP. The close button's code is Unload Me. What can be the problem?

no activex or slow network

I'm not using any activex neither access over a network. The database files are access files (mdb). I think that the problem comes from there somewhere, a connection to that database is not closed, but the forms that work with the database are created automatic by the VB6 wizzard.

Do forms reference each other? You could have a chain of circular references.....

TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010In theory, there is no difference between theory and practice; in practice there is.

* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first

Exit() (or something like that) and your program will close without you having to think about any forms that may be still open

greetings UNI

you mean END ?
it's not preferable to call END

from msdn :
Note The End statement stops code execution abruptly, without invoking the Unload, QueryUnload, or Terminate event, or any other Visual Basic code. Code you have placed in the Unload, QueryUnload, and Terminate events of forms and class modules is not executed. Objects created from class modules are destroyed, files opened using the Open statement are closed, and memory used by your program is freed. Object references held by other programs are invalidated.

Success

For the last 3 posts:

1) The Exit commands didn't help. I think that this command only interrupts a for, if, or sub execution without doing anythig else.

2) I'm not quite sure where to put that code. I've put it in the exit sub of the main form. Did i do good?
Putting the code in the exit sub didn't display any messages but also stopped from closing my application. I guess smthin' wrong.

3) An the last but not least and also THE SOLUTION were these three "magic" letters: END . I've commented the Unload Me and the code from Cimperiali and writted the END statement. My exit sub looks like this now:

Private Sub Iesire_Click()
End
End Sub

So i think that the problem is solved and i thank to all who helped me.

End - abrubpty terminate program

as hspc stated, End is to avoid: it terminates abruptly your code.
Obejcts that need to enter the Terminate_event (or even the
Unload_ procedure) to make cleanup, will not enter that code,
thus nothing is correctly cleaned....Better should be to step inside
code and try to understand what is going wrong (there is always
a "why" if a program does not really stop...). You may think you
have solved, now, and maybe it will work for you. But maybe a
bug will come out soon....

...at present time, using mainly Net 4.0, Vs 2010

Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

second thoughts

I guess there is a good reason why my program won't end well when i call the Unload command, but i can't figure it out why...all my forms have the unload command yet the program isn't ending.
Cimperiali gave me a code but i don't know where to put it. Could u give me a little more details, a little project where the code is implementing and working pls?