Solved

Automatically close a program after running

Posted on 2004-08-27
5
292 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 51

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

830 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