Solved

Restarting Application

Posted on 2000-05-10
9
181 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

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!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…

728 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