Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Restarting Application

Posted on 2000-05-10
9
Medium Priority
?
184 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 400 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:Brendt Hess
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
 
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

885 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