0

Getting InvalidOperationException or sometimes TargetInvocationException, When Control reaches at this function the Exception thrown.

private void setreminders()
    {
        DateTime Date1 = new DateTime(2014, 02, 10, 06, 00, 00);
        DateTime Date2 = new DateTime(2014, 02, 10, 07, 30, 00);


        Reminder _Reminder1 = new Reminder("TodoReminder")
        {

            BeginTime = Date1,
            Title = "Diet Reminder",
            Content = "Its time to wake up, Have a Glass of Water and Start Excercising like YOGA & PRANAYAMA",
        };
        _Reminder1.RecurrenceType = RecurrenceInterval.Daily;
        ScheduledActionService.Add(_Reminder1);

        Reminder _Reminder2 = new Reminder("TodoReminder")
        {

            BeginTime = Date2,
            Title = "Diet Reminder",
            Content = "Drink a Glass of Water",
        };
        _Reminder2.RecurrenceType = RecurrenceInterval.Daily;
        ScheduledActionService.Add(_Reminder2);


    }
Aditya Patil
  • 146
  • 9
  • 1
    You can't create reminder width an invalidate date.(before DateTime.now) et you can't add areminder with same name. You can check remidners in ScheduledActionService.Put a break point. – MatDev8 Feb 10 '14 at 11:40
  • I want that everyday on 9 AM will remind the user to Take Breakfast After that every day on 12 PM it should show reminder to take lunch? So want to add multiple reminders, can you tell me code for that. plzz – Aditya Patil Feb 10 '14 at 11:56
  • It looks like @MatDev8 already told you the answer. Give your reminders unique names, and ensure the BeginTime is in the future. – Shawn Kendrot Feb 10 '14 at 22:56
  • Even after giving unique names I am getting ArgumentoutofRange Exception – Aditya Patil Feb 11 '14 at 04:50

0 Answers0