Insert MonthCalendar

Chong

Regular
Joined
Apr 4, 2003
Messages
79
Will anyone show me how to insert the selected date from a MonthCalendar control? When I user click on a certain date on the MonthCalendar control, I want to insert this date into a textbox. How do I do that?

Many thanks in advance!

ljCharlie
 
In the DateChanged event you can use the argument e to get the start and end date range (both as DateTime variables):
C#:
textBox1.Text = e.Start.ToString("MM/dd/yyyy");
textBox2.Text = e.End.ToString("MM/dd/yyyy");

Otherwise, you can use the SelectionStart and SelectionEnd properties of the control to get the same DateTime values. If only one date is selected, both values will be the same.

-Nerseus
 
Back
Top