// Check for upcoming appointments
``` foreach (DataRow row in dtblAppointments.Rows)
{
DateTime eventDT =
DateTime.Parse(row["Start"].ToString());
if(eventDT > DateTime.Now && eventDT.AddMinutes(15)
>= DateTime.Now)
{
MessageBox.Show("Alert - Appointment "
row["ID"].ToString() " " row["Title"].ToString() "
starts in 15 minutes or less.");
}
}```
Updated the code, i copied in the wrong lines. Can someone help me create an alert for a appointment that is occurring within 15 min. This just randomly alerts for the entire day
CodePudding user response:
This will match only events occurring between now and 15 minutes from now. But it won't keep you from getting alerts multiple times within that period.
if (eventDT >= DateTime.Now && eventDT <= DateTime.Now.AddMinutes(15))
