Page 1 of 1

Cannot find .CurrentValue property

Posted: 24 Jan 2011, 15:34
by TickTick
How do I retrieve which date the user clicked in a Calendar control?
I mean not only bit the HitDate value which will be exposed when the user clicked it, but just anytime.
I thought there was a Calendar1.CurrentValue property, but there isn't.

Thank you very much for the help.

Re: Cannot find .CurrentValue property

Posted: 24 Jan 2011, 17:54
by TiKu
Hi!

Try the CaretDate property.

TiKu

Re: Cannot find .CurrentValue property

Posted: 24 Jan 2011, 20:52
by TickTick
For some reason it always returns "00:00:00" for me.

Re: Cannot find .CurrentValue property

Posted: 24 Jan 2011, 21:07
by TiKu
Which operating system do you use? Does your application use Windows themes? Can you provide a sample project which exhibits the behavior?

Re: Cannot find .CurrentValue property

Posted: 24 Jan 2011, 21:40
by TickTick
XP SP 2

Private Sub btnOk_Click()

m_bCancelled = False

m_Date = Me.Calendar1.CaretDate
If CStr(m_Date) = "00:00:00" Then
Me.BackColor = vbRed
Exit Sub
End If

Unload Me

End Sub

Does this help? I used an older version first, and I have upgraded to the latest version of the DateTimeControls now, but the behaviour is still the same.
Yes, I use themes.

Re: Cannot find .CurrentValue property

Posted: 25 Jan 2011, 07:49
by TiKu
How is m_Date defined? I'll have a look at it tonight.

Re: Cannot find .CurrentValue property

Posted: 25 Jan 2011, 08:12
by TickTick
As a boolean.

Just a joke.

As "Date" of course.

Re: Cannot find .CurrentValue property

Posted: 25 Jan 2011, 21:26
by TiKu
The Windows calendar control sometimes provides partly broken date values and the function that I use to convert those values to a VB6 date doesn't like such values.

I'll release an update tonight or tomorrow.