From: Mark on
This worked for me
If MousePosition.Y.ToString - Me.Top > 40 Then
Changed month
else
Changed day
end if



Randy wrote:

Capture Month Change with MonthCalendar
06-Oct-07

I have a MonthCalendar on one of my forms. I have disovered that the
DateChanged event is triggered not only when the user clicks on a new
date, but also if they click on the Previous or Next Month arrows
(meaning they click on either of the left or right pointing arrows in
the top corner). If the user changes the month, it messes up some of
the date logic that I have in the DateChanged event. Does anybody
know how I can capture this action? I'd like my code in the
DateChanged routine to work like this:

If MonthNotChanged then
Do Something
Else 'month changed
Do something Else
End if

Thanks,
Randy

EggHeadCafe - Software Developer Portal of Choice
WPF And The Model View View Model Pattern
http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da3425/wpf-and-the-model-view-vi.aspx
From: Alex Clark on
Wouldn't it be far easier to just store a static date variable in the
DateChanged event handler which holds the previous value, compare it to the
new value and step out if the month is different?

Whenever you start hard-coding mouse coordinates you open yourself up for a
world of pain on different screen resolutions, new versions of the control,
and different dimensions based on Windows theme settings or monitor DPI
settings.



<Mark Malin> wrote in message news:200992510838mark(a)malin.com...
> Sorry, here is a better description
> MonthCalendar1.MouseDown
> If MousePosition.Y.ToString - Me.Top > 40 Then
> Me.Tag = MonthCalendar1.SelectionStart
> Me.Hide()
> else
> 'Month change here'
> End If
>
> Since the mouse position is relative to the page, this makes it relative
> to the form the calendar is in.
>
> Hope this helps.
>
>
>
> Randy wrote:
>
> Capture Month Change with MonthCalendar
> 06-Oct-07
>
> I have a MonthCalendar on one of my forms. I have disovered that the
> DateChanged event is triggered not only when the user clicks on a new
> date, but also if they click on the Previous or Next Month arrows
> (meaning they click on either of the left or right pointing arrows in
> the top corner). If the user changes the month, it messes up some of
> the date logic that I have in the DateChanged event. Does anybody
> know how I can capture this action? I'd like my code in the
> DateChanged routine to work like this:
>
> If MonthNotChanged then
> Do Something
> Else 'month changed
> Do something Else
> End if
>
> Thanks,
> Randy
>
> EggHeadCafe - Software Developer Portal of Choice
> WPF And The Model View View Model Pattern
> http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da3425/wpf-and-the-model-view-vi.aspx