Solved

Restarting Application

Posted on 2000-05-10
9
174 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 14

Expert Comment

by:mcrider
Comment Utility
bhess1, what I said ;-)
0
 

Expert Comment

by:shmuly
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the points! Glad I could help!


Cheers!®©
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

9 Experts available now in Live!

Get 1:1 Help Now