Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, January 28, 2017 10:22 PM
Hi , can someone direct me to code examples that would allow a VB.net program to execute at a specific time of day? An example of use would be to archive files on a regular schedule. Thanks.
Michael Downing
All replies (4)
Saturday, January 28, 2017 10:28 PM ✅Answered | 2 votes
You would use Windows task scheduler, no code required.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383614(v=vs.85).aspx
With code
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
VB Forums - moderator
Sunday, January 29, 2017 6:13 PM ✅Answered
Hi Karen, some elaboration -
I have a VB.net program within Visual Studio. At present the Solution executes when [Debug > Start Debugging] is selected, and then a specific program executes based on a Button click on a Form.
How could I have this program execute based on time rather than by Debug or Button click?
Thanks.
Michael Downing
Michael,
A UI program *(Windows Forms or WPF) cannot do that. A program has to run already to execute. It can be done with a service but than becomes the service in fact a scheduler and you can for the same case use the solution Karen provided.
Success
Cor
Sunday, January 29, 2017 5:39 PM
Hi Karen, some elaboration -
I have a VB.net program within Visual Studio. At present the Solution executes when [Debug > Start Debugging] is selected, and then a specific program executes based on a Button click on a Form.
How could I have this program execute based on time rather than by Debug or Button click?
Thanks.
Michael Downing
Sunday, January 29, 2017 7:43 PM
Cor I suspected as much but thanks for confirming. Karen i will experiment with your Windows task scheduler option and open another thread under that subject if I have questions. This concludes the thread.
Michael Downing