Automatically close a program after running

Posted on 2004-08-27
Last Modified: 2010-05-02

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

On Form_Load
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?

Question by:sata
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
LVL 52

Expert Comment

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


Exit Sub

Accepted Solution

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


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

Expert Comment

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

Expert Comment

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

Expert Comment

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA filters 2 81
Can we place a tooltip on the actual vb6 form 5 57
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 66
Child Form in front 4 66
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

739 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