sata
asked on
Automatically close a program after running
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
After the execution of the code in Activate event call the form unload event and close the application there.
In your cmdActivate_click you jusst need the following line:
Unload Me
And the program will finish and the form won't show up
Unload Me
And the program will finish and the form won't show up
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
private sub Timer1_Timer()
timer1.enabled = false
unload me
end sub
like:
...
cmdActivate_click
End
Exit Sub
...