VB.NET 2005 DateTimePicker Custom Format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KA NMC
    New Member
    • Aug 2007
    • 40

    VB.NET 2005 DateTimePicker Custom Format

    I've noticed something strange when using the code below with a DateTimePicker
    wondering anyone else noticed or knows why this happens

    Code:
            Dim ws As String
            ws = "Not Available"
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = ws
    The above code gives me the result
    NoA Available

    For some reason lower case t's results in a upper case A

    Also notices that lower case y's results are a space then the number 8

    Code:
            Dim ws As String
            ws = "ty"
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = ws
    The above code gives me the result
    A_8

    Any ideas why this happens?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Becuase custom format is looking for things like "MM/dd/yyyy hh:mm:ss" etc. Some letters/characters have special meanings. For example, a "t" means AM/PM designater and y is part of the year i believe.
    You should look up how to create the specialized strings want on msdn.

    Comment

    • KA NMC
      New Member
      • Aug 2007
      • 40

      #3
      Thanks for the reply...After some research I did figure it out...

      Sorry for posting almost 80 days later

      Thanks

      Comment

      Working...