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

x
?
Solved

Automatically close a program after running

Posted on 2004-08-27
5
Medium Priority
?
331 Views
Last Modified: 2010-05-02
Hi,

I wrote a VB program, and the process goes like this:

On Form_Load
   subRead_the_ini_file
   cmdActivate_click
End sub

Actually after cmdActivate_click I would like the program to just close up, but I realize as I put the click event under the Form_load, although on activate the program it will automatically run the functions under the click event, but after it is comleted, the form will show up in the screen.

I'm planning to put this program in a server and let it automatically run every nite, so nobody will be there to close this program. How can I make it close?

Thanks,
sata
0
Comment
Question by:sata
5 Comments
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 11911037
try put "End" just after cmdActivate_click ?

like:

...
cmdActivate_click
End
Exit Sub
...
0
 
LVL 3

Accepted Solution

by:
rinksno1 earned 150 total points
ID: 11911053
at the cmdActivete_click() event type

cmdActivate_click
...
..

unload me        'will exit from your own program after the process of cmdActive
Exit Sub
0
 
LVL 1

Expert Comment

by:sanjeev_karnik
ID: 11911077
After the execution of the code in Activate event call the form unload event and close the application there.
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11911088
In your cmdActivate_click you jusst need the following line:

Unload Me

And the program will finish and the form won't show up
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11911105
Add a timer control on form, disable it, set Interval on 500, instead of cmdActivate_click put Timer1.Enabled =True

private sub Timer1_Timer()
  timer1.enabled = false
  unload me
end sub
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

876 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