473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Timer question

sm
Hi All,

I need to do a task at 3pm everyday. How do I set up the timer so that the
timer procedure executes at 3pm everyday? Is there any other solution other
than using a timer?

Thanks.
Nov 21 '05 #1
8 1992
I think you'd be better off using the windows task scheduler. Goto Control
Panel --> Scheduled Tasks and schedule your application to run at 3 pm
everyday. There are other useful options as well.

hope that helps..
Imran.

"sm" <sm@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Hi All,

I need to do a task at 3pm everyday. How do I set up the timer so that the
timer procedure executes at 3pm everyday? Is there any other solution other than using a timer?

Thanks.

Nov 21 '05 #2
sm

Can this be done programmatically?

I want to schedule a task programatically at a specified time of the day.

Regards

"Imran Koradia" wrote:
I think you'd be better off using the windows task scheduler. Goto Control
Panel --> Scheduled Tasks and schedule your application to run at 3 pm
everyday. There are other useful options as well.

hope that helps..
Imran.

"sm" <sm@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Hi All,

I need to do a task at 3pm everyday. How do I set up the timer so that the
timer procedure executes at 3pm everyday? Is there any other solution

other
than using a timer?

Thanks.


Nov 21 '05 #3
Hi SM,

Of course you can do this programmatically.
Dim mdate As Date

mdate = Now

MessageBox.Show(mdate.TimeOfDay.ToString)

This returns something like 09:43:16.1406250; from here it s/b easy to do
have your timer_tick method looking for a particular time and date and
reacting once it reaches 3:00 am.

HTH,

Bernie Yaeger

"sm" <sm@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Hi All,

I need to do a task at 3pm everyday. How do I set up the timer so that the
timer procedure executes at 3pm everyday? Is there any other solution
other
than using a timer?

Thanks.

Nov 21 '05 #4
Some links on automating the task scheduler:
http://groups.google.com/groups?th=d8011c56ce085de
http://www.thecodeproject.com/csharp/tsnewlib.asp

hope that helps..
Imran.

"sm" <sm@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...

Can this be done programmatically?

I want to schedule a task programatically at a specified time of the day.

Regards

"Imran Koradia" wrote:
I think you'd be better off using the windows task scheduler. Goto Control Panel --> Scheduled Tasks and schedule your application to run at 3 pm
everyday. There are other useful options as well.

hope that helps..
Imran.

"sm" <sm@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Hi All,

I need to do a task at 3pm everyday. How do I set up the timer so that the timer procedure executes at 3pm everyday? Is there any other solution

other
than using a timer?

Thanks.


Nov 21 '05 #5
Tym
On Tue, 19 Oct 2004 09:07:38 -0400, "Imran Koradia"
<no****@microsoft.com> wrote:
I think you'd be better off using the windows task scheduler. Goto Control
Panel --> Scheduled Tasks and schedule your application to run at 3 pm
everyday. There are other useful options as well.

hope that helps..


Yes - but he may have a program which is running all the time doing
something, and at 3pm has to do something else.

In this case, I would have an invisible form load with your
application and have something like (air code coming up....!)

Sub Form_Load
Do
do until format(now(),"HH:MM:SS") = "15:00:00"
doevents
loop
'it's now 3pm - and time to run the other process
Call Other Process
doevents
Loop
End Sub
I know it's not brilliant code - but you get the idea....
Nov 21 '05 #6
Wow...

That will eat up 50% CPU the entire time... [as per framework limitations]

"Tym" <no*****@ictis.net> wrote in message
news:ua********************************@4ax.com...
On Tue, 19 Oct 2004 09:07:38 -0400, "Imran Koradia"
<no****@microsoft.com> wrote:
I think you'd be better off using the windows task scheduler. Goto ControlPanel --> Scheduled Tasks and schedule your application to run at 3 pm
everyday. There are other useful options as well.

hope that helps..


Yes - but he may have a program which is running all the time doing
something, and at 3pm has to do something else.

In this case, I would have an invisible form load with your
application and have something like (air code coming up....!)

Sub Form_Load
Do
do until format(now(),"HH:MM:SS") = "15:00:00"
doevents
loop
'it's now 3pm - and time to run the other process
Call Other Process
doevents
Loop
End Sub
I know it's not brilliant code - but you get the idea....

Nov 21 '05 #7
Tym
On Tue, 19 Oct 2004 13:14:22 -0500, "CJ Taylor" <[cege] at [tavayn]
dit commmmm> wrote:
Wow...

That will eat up 50% CPU the entire time... [as per framework limitations]


I know - but it's about the best solution "in program" without
resorting to the external scheduler...
Nov 21 '05 #8
Tym,
No using one of the 3 Timer objects in .NET would be the "best solution in
program"!

There are three distinct timer objects in .NET:
- System.Windows.Forms.Timer
- System.Threading.Timer
- System.Timers.Timer

There is also a Timer function in VB.NET, however it does not really allow
you to schedule an event to occur at a specific time.

Of course using one of the above Timer objects requires that your program
actually be running at the specified time. If the event has to occur I would
probably use Threading.Timer or Timers.Timer in a Windows Service, as the
service will always run, even without anyone logged in, Of course the
machine needs to be physically turned on!

The following article in MSDN Magazine explains the difference between the
three timer objects in .NET & when to use each.

http://msdn.microsoft.com/msdnmag/is...T/default.aspx

The above article also discusses if & how each timer interacts with
threading.

Hope this helps
Jay

"Tym" <no*****@ictis.net> wrote in message
news:gu********************************@4ax.com...
On Tue, 19 Oct 2004 13:14:22 -0500, "CJ Taylor" <[cege] at [tavayn]
dit commmmm> wrote:
Wow...

That will eat up 50% CPU the entire time... [as per framework limitations]


I know - but it's about the best solution "in program" without
resorting to the external scheduler...

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: brian | last post by:
I have an ASP.Net application that uses impersonation. This works fine for accessing/executing the application. However, the app utilizes a timer, that when fired uses the <machine>ASPNET...
5
by: Richard P | last post by:
I need some help on timers. My app is asp.net 1.1 website running in a shared hosting environment with a third-party service provider. I currently request and cache 20 - 40 remote RSS feeds. When a...
6
by: Steve Jorgensen | last post by:
I know quite well that this question falls into the category of "why does Access misbehave when I do unexpected things to its objects?", but I thought I'd ask anyway, and see if anyone knows. ...
1
by: Paul Tomlinson | last post by:
Question about a System.Threading.Timer object and the "state" object you pass to it... Timer stateTimer = new Timer( = new TimerCallback( OnTimer ), o, 1000, 1000); I have an array of timer...
10
by: Bob | last post by:
Okay, I've done this for years but now I'm going to question it just because this idea has been at the back of my head since I started using DotNet... My WinForms app queries a database every 60...
7
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
11
by: Anil Gupte/iCinema.com | last post by:
When I use this Dim instance As New Timer I get the error: Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. Yet, in the help section for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.