Wierd Date Format Problem In TextBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cableguy69
    New Member
    • Oct 2006
    • 1

    #1

    Wierd Date Format Problem In TextBox

    Hello There.

    I am programming with visual basic within the Excel realm.

    I have a problem with the way my selected textbox recognizes dates generated from the datepicker.

    I am from New Zealand and have set me PC regional settings accordingly.
    Our date format is 26 October 2006, 26/10/06.

    I have formatted the textbox with the following code:

    textbox60.Value = DTPicker1.Value
    textbox60 = Format(textbox6 0, "dddd d mmmm")

    This works fine if the days in the month are 13th and above.
    Example: Date selected 26/10/06, the text will display as:

    Thursday 26 October

    But if the days are below the 13th, example:02/10/06, the date will display as:

    Friday 10 February

    I can see what is happening, the dates are swapping to the U.S format of 10/02/06, this is extremely annoying!!

    Can anyone help with some clean up code?

    Yours " Visual Virgin'
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Hi, just thought I'd jump in since you haven't got any replies yet.

    Could you tell me exactly what data type the DTPicker returns in its Value property? It might be that you are transferring it with some sort of default format, and we all know what that means. Perhaps you need to apply Format() when retrieving this value (and perhaps skip an intermediate step). In other words, instead of
    Code:
    textbox60.Value = DTPicker1.Value
    textbox60 = Format(textbox60, "dddd d mmmm")
    maybe you need to say something along these lines
    Code:
    textbox60.Value = Format(DTPicker1.Value, "dddd d mmmm")

    Comment

    Working...