MonthCalendar control question

  • Thread starter Thread starter vbmark
  • Start date Start date
V

vbmark

I want the MonthCalendar control to return the single day selected.

I have MaxSelectionCount = 1.

What I get back though is this:

"SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005 12:00:00 AM"

How do I get the single day date?

Thanks!
 
vbmark said:
I want the MonthCalendar control to return the single day selected.

I have MaxSelectionCount = 1.

What I get back though is this:

"SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005 12:00:00 AM"

How do I get the single day date?

Thanks!

Since you have set .MaxSelectionCount to 1, you will always have
..SelectionStart = .SelectionEnd = the selected date.
 
Since you have set .MaxSelectionCount to 1, you will always have
.SelectionStart = .SelectionEnd = the selected date.

It seems that the MonthCalendar control does not have the .SelectionStart
nor the .SelectionEnd property.
 
vbmark,
| I'm using VS 2005 beta 2. Sorry, I didn't mention that.

In VS 2005 beta 2 MonthCalendar also has a SelectionStart & SelectionEnd
http://msdn2.microsoft.com/library/khh5ycw4(en-us,vs.80).aspx

http://msdn2.microsoft.com/library/1sdaa0zt(en-us,vs.80).aspx

What specifically are you doing (post 5 to 10 lines of code) that you are
getting "SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005 12:00:00
AM"?

Hope this helps
Jay


| |
| >
| > vbmark wrote:
| > | >> @f14g2000cwb.googlegroups.com:
| >>
| >> >
| >> > vbmark wrote:
| >> >> I want the MonthCalendar control to return the single day
| > selected.
| >> >>
| >> >> I have MaxSelectionCount = 1.
| >> >>
| >> >> What I get back though is this:
| >> >>
| >> >> "SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005
| > 12:00:00
| >> > AM"
| >> >>
| >> >> How do I get the single day date?
| >> >>
| >> >> Thanks!
| >> >
| >> > Since you have set .MaxSelectionCount to 1, you will always have
| >> > .SelectionStart = .SelectionEnd = the selected date.
| >> >
| >>
| >> It seems that the MonthCalendar control does not have the
| > .SelectionStart
| >> nor the .SelectionEnd property.
| >
| > It does in framework version 1.1:
| >
| > <http://msdn.microsoft.com/library/en-
| us/cpref/html/frlrfsystemwindowsf
| > ormsmonthcalendarclassselectionstarttopic.asp>
| >
| > I don't know how to look stuff up for earlier framework versions,
| > sorry. One of the MVPs might be along soon.
| >
|
| I'm using VS 2005 beta 2. Sorry, I didn't mention that.
|
 
I keep trying but intellesence does not give me SelectionStart or End.
Nor do I see it in the object browser. Well, here's my code.

Public Class dlgDate

Private strDate As String

Private Sub dlgDate_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
With MonthCalendar1
.SetDate(frmMain.DateSelect())
.MaxSelectionCount = 1
End With
End Sub

Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles OK_Button.Click
frmMain.DateSelect = strDate
Me.Close()
End Sub

Private Sub MonthCalendar1_DateChanged(ByVal sender As Object, ByVal
e As System.Windows.Forms.DateRangeEventArgs) Handles
MonthCalendar1.DateChanged
strDate = MonthCalendar1.SelectionRange().ToString()
End Sub

End Class
 
I just learned that even though those functions do not show up they are
really there and do in fact work.

Thanks.
 
vbmark,
| strDate = MonthCalendar1.SelectionRange().ToString()
Ah! there's the rub.

You are asking the SelectionRange object to return the date range as a
string, ergo you are getting: "SelectionRange: Start: 5/5/2005 12:00:00 AM,
End: 5/5/2005 12:00:00 AM"

| I keep trying but intellesence does not give me SelectionStart or End.
| Nor do I see it in the object browser. Well, here's my code.
In VS.NET 2005 Beta 2 I see the SelectionStart & SelectionEnd in both
intellisence & the object browser, however I could not see them (with
minimal looking) in the Object Browser when designing the form.

FWIW:
MonthCalendar.SelectionStart

MonthCalendar.SelectionRange.Start

Both refer to the start date, while:

MonthCalendar.SelectionEnd

MonthCalendar.SelectionRange.End

SelectionRange, as its name implies refers to a range of dates.

Both refer to the end date, when you have ".MaxSelectionCount = 1" both
values with be the same date.

Hope this helps
Jay

|I keep trying but intellesence does not give me SelectionStart or End.
| Nor do I see it in the object browser. Well, here's my code.
|
| Public Class dlgDate
|
| Private strDate As String
|
| Private Sub dlgDate_Load(ByVal sender As Object, ByVal e As
| System.EventArgs) Handles Me.Load
| With MonthCalendar1
| .SetDate(frmMain.DateSelect())
| .MaxSelectionCount = 1
| End With
| End Sub
|
| Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e
| As System.EventArgs) Handles OK_Button.Click
| frmMain.DateSelect = strDate
| Me.Close()
| End Sub
|
| Private Sub MonthCalendar1_DateChanged(ByVal sender As Object, ByVal
| e As System.Windows.Forms.DateRangeEventArgs) Handles
| MonthCalendar1.DateChanged
| strDate = MonthCalendar1.SelectionRange().ToString()
| End Sub
|
| End Class
|
|
|
| |
| > vbmark,
| >| I'm using VS 2005 beta 2. Sorry, I didn't mention that.
| >
| > In VS 2005 beta 2 MonthCalendar also has a SelectionStart &
| > SelectionEnd
| > http://msdn2.microsoft.com/library/khh5ycw4(en-us,vs.80).aspx
| >
| > http://msdn2.microsoft.com/library/1sdaa0zt(en-us,vs.80).aspx
| >
| > What specifically are you doing (post 5 to 10 lines of code) that you
| > are getting "SelectionRange: Start: 5/5/2005 12:00:00 AM, End:
| > 5/5/2005 12:00:00 AM"?
| >
| > Hope this helps
| > Jay
| >
| >
| > | >| | >|
| >| >
| >| > vbmark wrote:
| >| > | >| >> @f14g2000cwb.googlegroups.com:
| >| >>
| >| >> >
| >| >> > vbmark wrote:
| >| >> >> I want the MonthCalendar control to return the single day
| >| > selected.
| >| >> >>
| >| >> >> I have MaxSelectionCount = 1.
| >| >> >>
| >| >> >> What I get back though is this:
| >| >> >>
| >| >> >> "SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005
| >| > 12:00:00
| >| >> > AM"
| >| >> >>
| >| >> >> How do I get the single day date?
| >| >> >>
| >| >> >> Thanks!
| >| >> >
| >| >> > Since you have set .MaxSelectionCount to 1, you will always have
| >| >> > .SelectionStart = .SelectionEnd = the selected date.
| >| >> >
| >| >>
| >| >> It seems that the MonthCalendar control does not have the
| >| > .SelectionStart
| >| >> nor the .SelectionEnd property.
| >| >
| >| > It does in framework version 1.1:
| >| >
| >| > <http://msdn.microsoft.com/library/en-
| >| us/cpref/html/frlrfsystemwindowsf
| >| > ormsmonthcalendarclassselectionstarttopic.asp>
| >| >
| >| > I don't know how to look stuff up for earlier framework versions,
| >| > sorry. One of the MVPs might be along soon.
| >| >
| >|
| >| I'm using VS 2005 beta 2. Sorry, I didn't mention that.
| >|
| >
| >
| >
|
 
Back
Top