Solved

Restarting Application

Posted on 2000-05-10
9
175 Views
Last Modified: 2010-05-02
Win98 2ndEd  VB5 Pro
Whats the easiest way (if any) to completely restart your app from within the app itself. (Everything gone, memory cleared etc.)
0
Comment
Question by:et1dkn
9 Comments
 
LVL 4

Expert Comment

by:dreamvb
ID: 2798138
Well for First you can clear all the variables and then
just load the app up agian

Load Form1

hope this help you in some way
0
 
LVL 14

Accepted Solution

by:
mcrider earned 100 total points
ID: 2798148
How about shelling a new copy of your program and terminating the old... You could also add some command line switches that you could parse on startup of your program so that when you restart, you don't do a splash screen or whatever...


Cheers!®©
0
 
LVL 2

Expert Comment

by:header
ID: 2798163
Make sure to unload all forms and set them equal to 'nothing'.  For example:

Unload form1
Set form1 = Nothing

This (and only this) will free up the memory that form1 was using.  Do not (repeat) do not use the END command.  That is the worst way to end your program.  Once all forms are unloaded, the program will automatically terminate.

Next you need to make sure all open files are closed. Simply saying "Close" will close all open files.

I would unload all forms and close files, then shell out to a seperate program.  That second program (small and simple) would terminate the first program and start up a new copy of the program.  As mcrider suggested, you could use command line parameters to indicate whether the program was being restarted or started for the first time.
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2798169
Probably the best way would be to unload all of your forms, close all of your files, use SHELL to start a new instance of your program, and execute an END statement.

Sub ShutDown()

Dim F as Form
Dim sName as String

For Each F in Forms
   Unload F
   Set F = Nothing
Next F
CloseAllDatabases   ' Subroutine to close all your open data files

sName = App.Path & "\" & App.EXEName & ".EXE"

SHELL(sName, vbNormalFocus)

END

End Sub
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:mcrider
ID: 2798175
bhess1, what I said ;-)
0
 

Expert Comment

by:shmuly
ID: 2798596
If you are trying to update your program with a new version, you would probably want to write a small program that you can start passing a command line argument of the name of your program. You would then strat this new program and terminate the main program. The new program could then update the main program and restart it.
0
 

Author Comment

by:et1dkn
ID: 2802731
Received several good responces as was yours good...a little late though...The question was quite theoretical and I guess has no firm answer.  I do appreciate your input.
 Thnx
et1dkn
0
 

Author Comment

by:et1dkn
ID: 2802744
As I told shmuly, probably no exact answer.  More like different ways that different people may use....(Note how similar they are).  Your comments seem to be along the line I was leaning....
so thanks for sharing.

et1dkn
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2803113
Thanks for the points! Glad I could help!


Cheers!®©
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now