Hello Everybody,
I'm stuck with my little project. I want to select multiple days in a monthcalendar and count the days and display this in a textbox.
I looked at different sites, but keep getting the error
When converting a string to DateTime, parse the string to take the date before putting each variable into DateTime object. Even with the explanation I.m not getting it to work
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
String DateTime1 = monthCalendar1.SelectionRange.Start.ToShortDateString();
String DateTime2 = monthCalendar1.SelectionEnd.ToShortDateString();
DateTime d1 = DateTime.ParseExact(DateTime1, "dd/MM/yyyy", null);
DateTime d2 = DateTime.ParseExact(DateTime2, "dd/MM/yyyy", null);
TimeSpan t1 = d2.Subtract(d1);
textBox1.Text = t1.ToString();
}
thanks for the help