Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month Calendar class question 1

Status
Not open for further replies.

paulcy82

Programmer
Jan 25, 2005
28
0
0
US
I want to set a variable equal to whatever the user clicks on the calendar. I have looked through the methods and properties and I cannot seem to find what I am looking for. Below is the code that I want to execute when the user clicks a date.

Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MthCal.DateChanged
curDate = MthCal.---What goes here---
End Sub
 
None of those choices exist that I can see
 
Under the toolbox it is called MonthCalendar. That is where I got it from. There is also a DateTimePicker.
 
It says that a value of that type cannot be converted to a date.

Dim curDate as Date
curDate = MthCal.selectionRange
 
That returns a type of SelectionRange not a Date. You can use the SelectionStart and SelectionEnd if you want to return a Date type.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
selectionStart works, but am I going to have a problem with this because this is for use with a range of dates? I only want one date selected. I ran the program and I do not see any problems, when I select a date my variable is set to that date. Just want to make sure.
 
Nope you won't have any problems - if only one date is selected the "range" is simply for that day so it is still a range but it just happens to only be for the same day.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top