Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
485
How can I move the calendar display by month view?
posted

 

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.

Parents
  • 485
    Offline posted

    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 Year As String= .ActiveDay.Date.Year.ToString

     Dim Month As String= MonthName(.ActiveDay.Month.MonthNumber)

     

    Me.lblMonth.Text = String.Format("{0} {1}", Month, Year)

     

    End With

     

     

     

     

     

     

     

Reply Children