jackjohnson44
asked on
vb application
I have a vb app, when I x out of the program, it still shows up in my task manager.
How do I prevent this?
How do I prevent this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jackjohnson44,
As a general rule, you should *always* manage the lifecycle of every object you create. So if you instantiate an object, open a connection or a form then you should ensure that you close it cleanly when you have finished using it. If you have com connections then you should ensure that you close the port when the form that the control sits on is closed. Likewise a database connection should be closed and set to nothing when you have finished with it.
Tim
As a general rule, you should *always* manage the lifecycle of every object you create. So if you instantiate an object, open a connection or a form then you should ensure that you close it cleanly when you have finished using it. If you have com connections then you should ensure that you close the port when the form that the control sits on is closed. Likewise a database connection should be closed and set to nothing when you have finished with it.
Tim
Any open hidden forms will keep it in the task bar or the task manager. If you forget to close your com or database connection then that will not keep the name in the task bar or the task manager but the computer resources is a different story.
If you are using MDI environment then set MDIForm.auotshowchildren to true and you will see which form comes up when it should not. Sometime I call the from name by mistake so this allow me to track that down.
Use timcottee code in your MDI Form or your main from unload event. That will make sure everything is unloaded.
If you are using MDI environment then set MDIForm.auotshowchildren to true and you will see which form comes up when it should not. Sometime I call the from name by mistake so this allow me to track that down.
Use timcottee code in your MDI Form or your main from unload event. That will make sure everything is unloaded.
On the form that you close:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
' Insert code to close any COM ports and db connections.
End
End Sub
That will do what you want.
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
' Insert code to close any COM ports and db connections.
End
End Sub
That will do what you want.
ASKER
is there a way to loop through db connections like TimCottee did with forms?
Are you saying that db connection is the one keeping the application name in the task bar or task lists? If so then that does not make sense.
Did you use global variable for your database connection?
Did you use global variable for your database connection?
ASKER
no, the form answer that TimCottee gave seems to work, and it wasn't the task bar, it was the task manager applications list.
Someone said I should close my db connections, I was wondering if there was a similar thing that I could do.
I think that it is working correctly now, but wanted to add that functionality if it would help.
Thanks
Someone said I should close my db connections, I was wondering if there was a similar thing that I could do.
I think that it is working correctly now, but wanted to add that functionality if it would help.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER