MonthCalendar

  • Thread starter Thread starter Lam
  • Start date Start date
L

Lam

Hi

I have a method to catch the event
private void calendar_DateSelected(object sender,
System.Windows.Forms.DateRangeEventArgs e)
{

}

Does anyone knows how can I get the selected date from MonthCalendar?
and rturn it as a string ?

Thanks a lot

Lam
 
Hi Lam,

You can use e.Start to retreive the selected date in the DateSelected event. Now to return it as a string, use "ToShortDateString", "ToLongDateString" methods to convert the date into its equivalent string representation. Here is an example:
Private Sub MonthCalendar1_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected

MessageBox.Show(e.Start.ToShortDateString)

End Sub

Hope this helps.

Thanks
Mona[Grapecity]
 
Back
Top