hi, i am new to c#, in my project, when a date on the monthcalendar is selected, i want to catch the date for future use (e.g. retrieve all the bookings on that date from db).
i have read some articles about this, now i can call "SelectionRange.start.ToString(); " to get the starting date and call "SelectionRange.end.ToString(); " to get the ending date.
what about a single date selected i tried "SelectionRange.start.ToString(); " and "SelectionRange.end.ToString(); " both work fine. I am just wondering if there is something specifically for a single date selection

question about retrieve single selected date in MonthCalendar
rooz
I'd say that your hint is not very helpful, sorry JohnAskew
I tried this: txt1.Text = MonthCalendar1.DateSelected.ToString();
it gave me error: "'System.Windows.Forms.MonthCalendar.DateSelected' can only appear on left hand side of += or -="
dont get it, plz help
caprio
MonthCalendar online help
It appears that what you've found is an event handler whose "DateRangeEventArgs" holds the selected date in it.
private void monthCalendar1_DateSelected(object sender, System.Windows.Forms.DateRangeEventArgs e)
{
// Show the start and end dates in the text box.
this.textBox1.Text = "Date Selected: Start = " +
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();
}
private void monthCalendar1_DateChanged(object sender, System.Windows.Forms.DateRangeEventArgs e)
{
// Show the start and end dates in the text box.
this.textBox1.Text = "Date Changed: Start = " +
e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();
}
Charles Gray
Look for a different property on the MonthCalendar that stores this data.
Perhaps a property called "date", e.g. myMonthCalendar.date to get or set the data.
theManMyth
rhallet