CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    DateTimePicker control

    Hello again ...

    Say, am I missing something or does the "DateTime" in the control name DateTimePicker refer to the DateTime structure rather than a Date and Time selection mechanism ?

    I'm trying to use it to select a date and a time of day. I can see that it permits one to select a date very nicely indeed, but no matter what I click on, double-click on, right click on, or click-using-small-toe-of-left-foot on, I don't see a clock that would permit one to select hours and minutes.

    In reading the blurb in the 'Help' section (normally, very helpful indeed), I see that it refers the reader to a discussion of custom formatting strings, but setting the custom format property with a string which contains time-of-day formatting does not seem to help.

    Consequently, never having seen the control before, I must ask if I am simply failing to program it properly to get a clock icon, or does it not provide a mechanism for setting time of day ....

    in summary does 'DateTimePicker' mean date and time-of-day selection mechanism, or DateTime Structure selection mechanism (with fixed time)?

    For the moment, I use it to select the date only, and provide a separate text box for the user to enter the designated execution time in hours and minutes, but if there's a cool way to do it using the datetimepicker, I sure would like to know.

    Can anyone out there help this poor, age-muddled fool ?

    thanks.

    bill

  2. #2
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    Re: DateTimePicker control

    If you set the Format property to "Custom" then set the CustomFormat property to a suitable value such as "dd/MM/yyyy HH:mm.ss" this will kind of do it.

    Certainly does it easier then the current way you are doing it. It's not "cool", but it does it all in one box which isn't uncool

  3. #3
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: DateTimePicker control

    Hey Zeb ... thanks !

    That did it. I didn't know about the 'Format' property so although I was setting the formatting string property correctly, I guess it was useless since I wasn't setting the format property to 'custom'. I added that single statement and Voila ! And it's certainly a heck of a lot better than using the extra text box which has since been removed.

    Say, I couldn't help but notice that you're located in or near Melbourne. Man, I love that place. I spent many joyful months there more years ago than I care to admit to. Eight great months as I recall. I was staying in downtown Melbourne in what was then Noah's Hotel (across the street from the 'Southern Cross'), and each day I'd drive out to Williamstown Naval dockyard to work on the Seabeam sonar system.

    RAN was still building HMAS Cook as a platform for the Seabeam so I didn't get to install it, but I did get to run dockside tests, then teach a Seabeam class there. That work in Melbourne was probably the funnest project I ever had.

    OK - thanks for your help, Zeb.

    Best wishes.

    bill
    Last edited by ThermoSight; April 27th, 2009 at 10:23 AM.

  4. #4
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    Re: DateTimePicker control

    I used to work for the mob that built the ships at Williamstown (although in a different, more "boring" division). Good to hear you enjoyed Melbourne - it's a great place - if you want it to be.

    Glad I could help

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

Featured