Solved

Automatically close a program after running

Posted on 2004-08-27
5
256 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 49

Expert Comment

by:Ryan Chong
Comment Utility
try put "End" just after cmdActivate_click ?

like:

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

Accepted Solution

by:
rinksno1 earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now