In the form1 load event I am running this code

        Dim NewCalendar As New MonthCalendar
        NewCalendar.Name = "DateSelecter"
        NewCalendar.Size = New Size(80, 80)
        NewCalendar.Location = New Point(100, 100)
        NewCalendar.Visible = True

        AddHandler NewCalendar.DateSelected, AddressOf DateSelecter_DateSelected


However I can not work out how to get the value from the month calendar, so my question is how can I get the value of the month calendar in the DateSelecter_DateSelected sub.

Kindest regards,


You can try something like this:

Dim WithEvents MonthCalendar1 As New MonthCalendar

Private Sub MC1_DateChanged(sender As Object, e As DateRangeEventArgs) Handles MonthCalendar1.DateSelected
    'This will get the dates
    Dim dtStart As Date = e.Start
    Dim dtEnd As Date = e.End

    'This will create a timespan from those dates.
    Dim dtRange As TimeSpan = dtEnd - dtStart
End Sub

Edited 3 Years Ago by Begginnerdev

Thank you very much for the help, it solved my problem so I will mark this as solved.

Many thanks,


This question has already been answered. Start a new discussion instead.