Ticket T732142
Visible to All Users

DateEdit - How to show only a month and a year in a drop-down calendar

created 6 years ago

Is there a way to allow only Month and Year to be selected and displayed in a DateEdit.  I have the Edit Format set to "y" which seems to display the Month Year correctly, but the year and month navigation buttons do not function.  Any help would be appreciated.

Mike

Answers approved by DevExpress Support

created 6 years ago

Hi Mike,

To show only a month and a year in a drop-down calendar, set the DateEdit.Properties.VistaCalendarViewStyle property to YearView:

Visual Basic
dateEdit1.Properties.Mask.EditMask = "Y" dateEdit1.Properties.Mask.UseMaskAsDisplayFormat = True dateEdit1.Properties.VistaCalendarViewStyle = DevExpress.XtraEditors.VistaCalendarViewStyle.YearView

Please try it and let us know your results.

    Show previous comments (1)
    DevExpress Support Team 6 years ago

      I tried to reproduce the issue, but all my attempts were unsuccessful. I have created a simple project based on your description and it works properly on my side. Would you please modify it to illustrate the issue?
      Also make sure that in your case, MaxValue does not equal MinValue. This may be the cause of this behavior.
      I look forward to your reply.

        I was able to find the issue with your max min value suggestion.  The dateedit was in a userControl that had designer code that initialized these values incorrectly.

        Thanks.

        DevExpress Support Team 6 years ago

          I am happy to hear that the issue has been resolved.
          Please feel free to contact us in case of any questions.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.