Solved

Restarting Application

Posted on 2000-05-10
9
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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
 
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

Technology Partners: 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!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

738 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