I want to schedule toast notification for a specific date and time like 18/3/2015 4:00 PM for windows app in c# for a calender app. I have made 3 combo-boxes (NewEventYear) & so on. What i am trying is..
int x = int.Parse(NewEventYear.SelectedItem.ToString());
/* y & z for month and date respectively */
DateTime EventDate = new DateTime(x,y,z);
ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, EventDate);
i am getting an error
"FormatException was unhandled by user code : Input string was not in correct format"
pointing at
int x = int.Parse(NewEventYear.SelectedItem.ToString());
Thank you for the help. Solved my problem by writing this code.
int x = int.Parse(NewEventYear.SelectedItem.ToString());
int y = int.Parse(NewEventMonth.SelectedItem.ToString());
int z = int.Parse(NewEventDate.SelectedItem.ToString());
int a = int.Parse(NewEventHour.SelectedItem.ToString());
int b = int.Parse(NewEventMinutes.SelectedItem.ToString());
DateTime EventDate = new DateTime(x,y,z,a,b,0)
TimeSpan NotTime = EventDate.Subtract(DateTime.Now);
DateTime dueTime = DateTime.Now.Add(NotTime);
ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, dueTime);
ToastNotificationManager.CreateToastNotifier().AddToSchedule(scheduledToast);