473,387 Members | 1,789 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,387 software developers and data experts.

Help with timer(s)?

I admit it - I don't have the foggiest notion how to use the timer
class(es) in c# - i've looked at tutorials, and it's still completely
unintutive to me. Anyone nice enough to get me started on the following
problem would be my favorite person in the world!

A file is made available on a network drive sometime after noon, and I
want to copy it. I want the application to wait until 12 noon, check
for the file, if it's there, copy it, if not wait check again every 15
minutes. At 4pm, if the file still hasn't been copied, email a
particular person.

I've written a "manual" version of the above app, requiring the user to
click a button to check for/copy the file. It's the timer stuff that
I'm clueless on.

Any help would be appreciated...

cdj

Aug 10 '06 #1
3 1312
Hi,

At the end what kind of app this will run in?

Working with timers is super easy, all you have to do is set the interval
you want and the method you want to be invoked.

When the method is execute you do your work and you can modify the timer if
needed.

IIRC one of the timers need to either be restarted everytime or need to set
a property in order to do so.
In any case post some code and will figure out why its not working
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"sherifffruitfly" <sh*************@gmail.comwrote in message
news:11**********************@q16g2000cwq.googlegr oups.com...
>I admit it - I don't have the foggiest notion how to use the timer
class(es) in c# - i've looked at tutorials, and it's still completely
unintutive to me. Anyone nice enough to get me started on the following
problem would be my favorite person in the world!

A file is made available on a network drive sometime after noon, and I
want to copy it. I want the application to wait until 12 noon, check
for the file, if it's there, copy it, if not wait check again every 15
minutes. At 4pm, if the file still hasn't been copied, email a
particular person.

I've written a "manual" version of the above app, requiring the user to
click a button to check for/copy the file. It's the timer stuff that
I'm clueless on.

Any help would be appreciated...

cdj

Aug 10 '06 #2
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

At the end what kind of app this will run in?
I've got it running in my system tray now... Offhand, I see no reason
to move it from there... I figure on just keeping it running in the
tray all the time, and changing the tray icon upon a successful copy.
That's all straightforward, and is working now.

It's just time timer stuff specifically that I'm clueless on.
Working with timers is super easy, all you have to do is set the interval
you want and the method you want to be invoked.
In any case post some code and will figure out why its not working
I don't have any timer code yet - that was the point of my request -
lol.

Here's the download routine as it currently stands (it's just the event
handler for the button click):

private void downloadRates(string sourceFile, string destinationFile)
{
WebClient client = new WebClient();
client.Credentials = CredentialCache.DefaultCredentials;

try
{
client.DownloadFile(sourceFile, destinationFile);
}
catch(Exception e)
{
MessageBox.Show(
e.Message+"\n\nException source: "+e.Source+"\n\n"+e.ToString(),
"failed to download Dow Jones prices");
}
}

I'm basically looking to put this on a timer, like I mentioned.

Thanks for replying - I suspect I'll just have to go spend some more
time with what-seems-to-me-unintelligible timer tutorial sites...
Thanks again,

cdj

Aug 10 '06 #3
Hi,
I'm basically looking to put this on a timer, like I mentioned.

Thanks for replying - I suspect I'll just have to go spend some more
time with what-seems-to-me-unintelligible timer tutorial sites...
Yep, that would be a good idea

Just add a timer fmro the toolbox, set its property and double click the
icon to create the method. then all you have to do is call your download
routine from there
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Aug 14 '06 #4

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

Similar topics

1
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h...
9
by: tym | last post by:
HELP!!! I'm going round the twist with this... I have a VB6 application which is using DAO to access a database (Please - no lectures on ADO, I know what I'm doing with DAO!!) Ok, problem...
2
by: MyNameIsnt | last post by:
Can anyone tell me why, when I click on the buttons it register 2 characters on the display? if you use the right mousebutton it works ok, but the buttons dont flash?? it works fine without the...
2
by: Alfonso Morra | last post by:
Hi, I am writing a timer class that I want to be able to get to notify me (via a callback func), when a specified interval has elapsed. I have most of the timer functionality figured - however,...
10
by: WhiteSocksGuy | last post by:
Help! I am new to Visual Basic .Net (version 2002) and I am trying to get a System.Timers.Timer to work for me to display a splash screen for about two seconds and then load the main form. I have...
7
by: steve marchant | last post by:
trying to learn VB6. Simple counting loop which counts to 8 in 1 sec intervals, then starts from 1 again and repeats. Have two Command buttons on the form. Cmd1 starts the counting, and I need to...
4
by: Lemune | last post by:
Hello everyone. I'm using vb 2005. I'm creating program that run as service on windows. And in my program I need to use timer, so I'm using timer object from component. I try my source code on...
11
by: Zilla | last post by:
I have the following simple program. I just want to be able to do math operations (+, -, =)on Timer sublcasses, but want to handle cases where either rhs or lhs is an intrinsic value, However, the...
3
by: mxmillercell | last post by:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace timertest {
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...

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.