none
datetimepicker in vb.net 2005 show only month and year

Answers

  • Is it possible to show only Month and Year in datetimepicker to select.

    h2007


    You can set up a custom format for a DateTime picker control, but you might also want to have a look at the Calendar Control - it sounds to be more suited to what you want.


    Please call me Frank :)

    • Proposed as answer by IronRazerz Tuesday, January 07, 2014 3:33 AM
    • Marked as answer by Carl CaiModerator Monday, January 13, 2014 9:13 AM
    Tuesday, January 07, 2014 3:26 AM
  • Hi,

     I don`t know if this will help you but, you can use a custom format like below

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            DateTimePicker1.CustomFormat = " MM, yyyy"
            DateTimePicker1.Format = DateTimePickerFormat.Custom
        End Sub
    

    Tuesday, January 07, 2014 3:32 AM
  • But if i click on control it still gives me day calendar. I want to show only month and year to select and not day.

    h2007


    Then I think you'd be better to just use two ComboBoxes - one for the year and one for the month.

    Please call me Frank :)

    Tuesday, January 07, 2014 3:56 AM
  • But if i click on control it still gives me day calendar. I want to show only month and year to select and not day.

    h2007

     I don`t believe you can do that. You could show the updown buttons instead of the dropdown but, you need to click on the month or year and then click the up/down buttons.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            DateTimePicker1.ShowUpDown = True
            DateTimePicker1.CustomFormat = " MM, yyyy"
            DateTimePicker1.Format = DateTimePickerFormat.Custom
        End Sub
    

    Tuesday, January 07, 2014 3:57 AM

All replies

  • Is it possible to show only Month and Year in datetimepicker to select.

    h2007


    You can set up a custom format for a DateTime picker control, but you might also want to have a look at the Calendar Control - it sounds to be more suited to what you want.


    Please call me Frank :)

    • Proposed as answer by IronRazerz Tuesday, January 07, 2014 3:33 AM
    • Marked as answer by Carl CaiModerator Monday, January 13, 2014 9:13 AM
    Tuesday, January 07, 2014 3:26 AM
  • Hi,

     I don`t know if this will help you but, you can use a custom format like below

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            DateTimePicker1.CustomFormat = " MM, yyyy"
            DateTimePicker1.Format = DateTimePickerFormat.Custom
        End Sub
    

    Tuesday, January 07, 2014 3:32 AM
  • But if i click on control it still gives me day calendar. I want to show only month and year to select and not day.

    h2007

    Tuesday, January 07, 2014 3:44 AM
  • But if i click on control it still gives me day calendar. I want to show only month and year to select and not day.

    h2007


    Then I think you'd be better to just use two ComboBoxes - one for the year and one for the month.

    Please call me Frank :)

    Tuesday, January 07, 2014 3:56 AM
  • But if i click on control it still gives me day calendar. I want to show only month and year to select and not day.

    h2007

     I don`t believe you can do that. You could show the updown buttons instead of the dropdown but, you need to click on the month or year and then click the up/down buttons.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            DateTimePicker1.ShowUpDown = True
            DateTimePicker1.CustomFormat = " MM, yyyy"
            DateTimePicker1.Format = DateTimePickerFormat.Custom
        End Sub
    

    Tuesday, January 07, 2014 3:57 AM