This project has moved. For the latest updates, please go here.

How to add checked CheckBoxes to the DaysOfWeek setting?

Nov 18, 2012 at 3:41 PM

Hi there,

I'm working in VB2010 not in C# but I hope someone can help me with my problem.

I'm currently playing with this library to create scheduled tasks in Windows and now I have a question.

I've created a Form with 7 CheckBoxes (Mon - Fri) and my goal is to add only the checked days to the DaysOfWeek setting.

So for example, if I check the CheckBox1 (Sunday) and CheckBox6 (Friday) I want that the DaysofWeek setting should be wt.DaysOfWeek = DaysOfTheWeek.Sunday Or DaysOfTheWeek.Friday

Can anybody help me with that?

Thank you very much in advance,

Corpy

Nov 19, 2012 at 1:42 PM
Edited Nov 19, 2012 at 3:32 PM

Here is some code I use

                Dim wt As WeeklyTrigger = DirectCast(td.Triggers.Add(New WeeklyTrigger()), WeeklyTrigger)
                wt.StartBoundary = DateTime.Today + TimeSpan.FromHours(8)
                wt.DaysOfWeek = DaysOfTheWeek.Monday Or DaysOfTheWeek.Tuesday Or DaysOfTheWeek.Wednesday Or DaysOfTheWeek.Thursday Or DaysOfTheWeek.Friday
                wt.Repetition.Duration = TimeSpan.FromHours(12)
                wt.Repetition.Interval = TimeSpan.FromMinutes(5)
                wt.Enabled = True
                wt = DirectCast(td.Triggers.Add(New WeeklyTrigger()), WeeklyTrigger)
                wt.StartBoundary = DateTime.Today + TimeSpan.FromHours(8)
                wt.DaysOfWeek = DaysOfTheWeek.Saturday Or DaysOfTheWeek.Sunday
                wt.Repetition.Duration = TimeSpan.FromHours(12)
                wt.Repetition.Interval = TimeSpan.FromMinutes(15)
                wt.Enabled = True

 

 

 

Nov 20, 2012 at 4:13 PM

Thank you very much, I'll try it :-)