Results 1 to 9 of 9

Thread: DTPicker format

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    DTPicker format

    Hi

    How can I to let DTpicker control forever same format (dd/mm/yyyy) , in any Regional Settings ?

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: DTPicker format

    Set the .CustomFormat ="dd/mm/yyyy" and .Format = dtpCustom property to your desired date format.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

  4. #4

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Re: DTPicker format

    each new project

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: DTPicker format

    In that case open new project, add DTPicker to your form, change all properties as you wish and save form to your Template folder but give it some meaningful name

    C:\Program Files\Microsoft Visual Studio\VB98\Template\Forms

    Directory above is the default so if you installed VB elsewhere look there instead.
    When you done with this then you can use your brand new template in every project (from Project > Add Form... menu) and it will appear in exact the same way when you saved it.
    You can also create another templates for whatever reason there is.

    Good luck.

  6. #6
    New Member
    Join Date
    Sep 2006
    Posts
    2

    Re: DTPicker format

    Hi,
    I have the same problem - I use the DTPicker with custom format, and the custom format string is "HH:mm:ss" (I don't want AM/PM no matter what regional setting are there). But the problem is that now the control has the calendar view, which I don't want. I use this control only for time settings, and I just want to get rid of the AM/PM to always see 24 hours format.
    Does anyone know how can I do that? Is there other control that can give me this functinallity (I try to avoid writing one by myself...).
    Thanks,
    Shay

  7. #7
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: DTPicker format

    Here is what you can do:
    VB Code:
    1. Private Sub Form_Load()
    2.     With DTPicker1
    3.         .Format = dtpCustom
    4.         'use this format as is - upper/lower case is important (HH = 24 hours; hh = 12 hours)
    5.         .CustomFormat = "HH:mm:ss"
    6.         .UpDown = True '<<< set this so calendar will not show
    7.         .Value = Now
    8.     End With
    9. End Sub

  8. #8
    New Member
    Join Date
    Sep 2006
    Posts
    2

    Re: DTPicker format

    Thanks, man, that works!
    Shay

  9. #9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width