Hello, I have two buttons on my form that I want to use to move the displayed calendar back or forward by one month. I have tried serveral options trying to use the ActiveDay, but that is not consistant in properly positioning the whole month within view. I would also like to change the Month and Year display to indicate what month you are looking at.
This all seems like pretty basic stuff, but I have been unable to find any help in looking through the forms and KB. Any help would certainly be appreciated.
Thank you.
Ok, I got the month label displaying correctly, but I'm still looking for how to get the first week of the month that I go to (using the arrows) to show up as the first week in the displayed calendar.
Below is the code I have that sets the label and moves the calendar display, but does not put the fist week of the month at the top. (AddMonths(1) to go forward, (-1) to go backward.)
Dim StartDate As DateTime = Me .Calendar.CalendarInfo.ActiveDay.Date
StartDate = StartDate.AddMonths(1)
With Me.Calendar.CalendarInfo
.ActiveDay = .GetDay(StartDate, True)
Dim Month As String= MonthName(.ActiveDay.Month.MonthNumber)
You can use the control's ScrollDayIntoView method to bring a particualr date into the viewable area of the control. There is an overload that takes a 'firstVisibleWeek' parameter; when true this will make the specified date appear in the first row of dates displayed.
Excellent, that did the trick. Thank you.