Click here to Skip to main content
15,905,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: Connecting to pre-2007 Access database from Vista Pin
Jamie Nordmeyer25-May-09 8:02
Jamie Nordmeyer25-May-09 8:02 
GeneralRe: Connecting to pre-2007 Access database from Vista Pin
Luc Pattyn25-May-09 8:14
sitebuilderLuc Pattyn25-May-09 8:14 
QuestionSending mail with attachment (Bitmap) from MemoryStream don't work Pin
thirstyhunter25-May-09 6:38
thirstyhunter25-May-09 6:38 
AnswerRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
Jacob Dixon25-May-09 7:01
Jacob Dixon25-May-09 7:01 
AnswerRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
Luc Pattyn25-May-09 7:12
sitebuilderLuc Pattyn25-May-09 7:12 
GeneralRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
thirstyhunter25-May-09 9:04
thirstyhunter25-May-09 9:04 
GeneralRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
Luc Pattyn25-May-09 9:20
sitebuilderLuc Pattyn25-May-09 9:20 
GeneralRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
thirstyhunter25-May-09 9:36
thirstyhunter25-May-09 9:36 
GeneralRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
Luc Pattyn25-May-09 9:38
sitebuilderLuc Pattyn25-May-09 9:38 
GeneralRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
thirstyhunter25-May-09 9:52
thirstyhunter25-May-09 9:52 
GeneralRe: Sending mail with attachment (Bitmap) from MemoryStream don't work Pin
nancydotcom22-Jun-10 8:28
nancydotcom22-Jun-10 8:28 
QuestionReports every Monday at 7am. Pin
Jacob Dixon25-May-09 6:38
Jacob Dixon25-May-09 6:38 
AnswerRe: Reports every Monday at 7am. Pin
dan!sh 25-May-09 7:17
professional dan!sh 25-May-09 7:17 
GeneralRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 7:30
Jacob Dixon25-May-09 7:30 
GeneralRe: Reports every Monday at 7am. Pin
Luc Pattyn25-May-09 7:37
sitebuilderLuc Pattyn25-May-09 7:37 
GeneralRe: Reports every Monday at 7am. Pin
Le centriste28-May-09 8:33
Le centriste28-May-09 8:33 
GeneralRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 15:20
Jacob Dixon25-May-09 15:20 
AnswerRe: Reports every Monday at 7am. Pin
Le centriste25-May-09 7:18
Le centriste25-May-09 7:18 
AnswerRe: Reports every Monday at 7am. Pin
_Maxxx_25-May-09 12:27
professional_Maxxx_25-May-09 12:27 
GeneralRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 15:26
Jacob Dixon25-May-09 15:26 
AnswerRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 15:36
Jacob Dixon25-May-09 15:36 
GeneralRe: Reports every Monday at 7am. Pin
_Maxxx_25-May-09 19:05
professional_Maxxx_25-May-09 19:05 
That would run your report at 00:02 (or there abouts) on monday and, if you don't persist the 'ran' status somehow, won't work if the program is stopped for any reason (if it is restarted on a Monday you would always get another copy of the report).

Maybe..


timer.Stop();
if (!ran && DateTime.Today.DayOfWeek == dayToRun && DateTime.Now.TimeOfDay >= timeToRun)
{
    PrepareReport();
    ran = true;
}

timer.Interval = MillisecondsBeforeTimeToRun();
            ran = false;
timer.Start();


Then you write MillisecondsBeforeTimeToRun() to calculate how long between now and the next time you want to test for the report being run.
Simplest case - if today is report day and the report has not been run, it's the difference between the time right now and the report time.
If the day is report day and the report has been run, it's 6 days from now plus the number of minutes until midnight from now, plus the report time.
If the day is not report day, you can safely leave it for (24 - now) + report time before checking again (or you can work it out accurately)

All this is obviously a bit pedantic - if you are just running one report once a week - I mean, the overheads of the polling every 2 mins are nothing - but it's nice to do these things 'properly'

___________________________________________
.\\axxx
(That's an 'M')

QuestionPop ContextMenu on NotifyIcon without mouse activity Pin
jackgeek25-May-09 5:58
jackgeek25-May-09 5:58 
QuestionRe: Pop ContextMenu on NotifyIcon without mouse activity Pin
jackgeek29-May-09 12:23
jackgeek29-May-09 12:23 
QuestionNeed help with TableAdapter problem [modified] Pin
kensai25-May-09 5:01
kensai25-May-09 5:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.