PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DateTimePicker Control  (Read 748 times)

Andrew Lindsay

  • Junior Member
  • **
  • Posts: 76
DateTimePicker Control
« on: December 19, 2009, 05:26:45 PM »

Hello,
 
I can get the time of a DateTimePicker Control by FF_TextBox_GetText(...),
 
but I can't seem to set the text using the FF_TextBox_SetText(...) way.
 
I have also tried to set the time in the Min Time and Max Time categories of the Properties list.
 
Any assistance would be appreciated.
 
Regards
 
Andrew
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8790
  • Windows 10
    • PlanetSquires Software
Re: DateTimePicker Control
« Reply #1 on: December 19, 2009, 06:16:05 PM »

Hi Andrew,

Everything DateTimePicker can be found here:
http://msdn.microsoft.com/en-us/library/bb761727(VS.85).aspx

Here is how to set the date range from Jan 1, 2000 to Jan 1, 2005 and to set the current date to Jan 1, 2001.

Code: [Select]

    Dim   DateRange(1)     As SYSTEMTIME

    DateRange(0).wYear      = 2000
    DateRange(0).wMonth     = 1
    DateRange(0).wDayOfWeek = 0
    DateRange(0).wDay       = 1
    DateRange(0).wHour      = 0
    DateRange(0).wMinute    = 0
    DateRange(0).wSecond    = 0

    DateRange(1).wYear      = 2005
    DateRange(1).wMonth     = 1
    DateRange(1).wDayOfWeek = 0
    DateRange(1).wDay       = 1
    DateRange(1).wHour      = 23
    DateRange(1).wMinute    = 59
    DateRange(1).wSecond    = 59

    SendMessage hWndControl, %DTM_SETRANGE, %GDTR_MIN Or %GDTR_MAX, ByVal VarPtr(DateRange(0))

    DateRange(0).wYear      = 2001
    DateRange(0).wMonth     = 1
    DateRange(0).wDayOfWeek = 0
    DateRange(0).wDay       = 1
    DateRange(0).wHour      = 0
    DateRange(0).wMinute    = 0
    DateRange(0).wSecond    = 0

    SendMessage hWndControl, %DTM_SETSYSTEMTIME, %GDT_VALID, ByVal VarPtr(DateRange(0))
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer