Navigating by Year on the Calendar function?

Is there a way to navigate by year as well Having to click on each month to get several years ahead is awfully inconvenient.

Answer this question

Navigating by Year on the Calendar function?

  • tibballs

    Eh, what is SelectionStart I'm using VB 2k5 and VWDE 2k5. There is no SelectionStart.

  • Jamie Thomson

    Okay, I've figured out how to navigate by year, but I need to know how to put a << and >> inside the Calendar class itself (again still using VB) to navigate by year instead of having two external buttons. Anyone have any ideas on how to do this

  • wirwin

    Just add two small buttons to your form. Use code like this:

    private void btnNextYear_Click(object sender, EventArgs e) {
    DateTime cur = monthCalendar1.SelectionStart;
    cur = cur.AddYears(1);
    monthCalendar1.SelectionStart = cur;
    }
    private void btnPrevYear_Click(object sender, EventArgs e) {
    DateTime cur = monthCalendar1.SelectionStart;
    cur = cur.AddYears(1);
    monthCalendar1.SelectionStart = cur;
    }

    Moved to Windows Forms General forum.


  • zproxy

    You cannot add controls to the MonthCalendar itself, it is a built-in native "UserControl" in Windows. You can put your own buttons on top of it though. Make them look like the month scroll buttons and nobody can tell the difference.


  • Navigating by Year on the Calendar function?