Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Date Control

Date Control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcsherry
    wrote on last edited by
    #1

    I'm using the date control on a dialog. When the dialog is displayed I need to set the day field of this control to be selected. Can anyone tell me how to do this? thanks, Andy

    J N M 3 Replies Last reply
    0
    • M mcsherry

      I'm using the date control on a dialog. When the dialog is displayed I need to set the day field of this control to be selected. Can anyone tell me how to do this? thanks, Andy

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      Are we talking about a CDateTimeCtrl here? Normaly, you call SetTime() on a control-variable of type CDateTimeCtrl you added to your dialog. This would require the time you want to set in a CTime or COleDateTime class or a SYSTEMTIME structure. Another, more complicated, way would be to send the control a DTM_SETSYSTEMTIME message.


      Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
      George Orwell, "Keep the Aspidistra Flying", Opening words

      1 Reply Last reply
      0
      • M mcsherry

        I'm using the date control on a dialog. When the dialog is displayed I need to set the day field of this control to be selected. Can anyone tell me how to do this? thanks, Andy

        N Offline
        N Offline
        Nishad S
        wrote on last edited by
        #3

        Use GetMonthCalCtrl to get CMonthCalCtrl from a CDateTimeCtrl. Use SetCurSel to select a date. Sample from MSDN: CDateTimeCtrl* pCtrl = (CDateTimeCtrl*) GetDlgItem(IDC_DATETIMEPICKER1); CMonthCalCtrl* pMoCalCtrl = pCtrl->GetMonthCalCtrl(); CTime dt2(1998, 3, 15, 0, 0, 0); pMoCalCtrl->SetCurSel(dt2);

        - NS -

        1 Reply Last reply
        0
        • M mcsherry

          I'm using the date control on a dialog. When the dialog is displayed I need to set the day field of this control to be selected. Can anyone tell me how to do this? thanks, Andy

          M Offline
          M Offline
          mcsherry
          wrote on last edited by
          #4

          ok, I think I may not have explained it clearly enough, what I need is for the day field of the control to be selected (i.e. if the user types then the day changes). I'm using a Date Time control which is liniked to a CDateTimeCtrl object. cheers,

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups