• Welcome to PlanetSquires Forums.
 

DateTimePicker Control

Started by Andrew Lindsay, December 19, 2009, 05:26:45 PM

Previous topic - Next topic

Andrew Lindsay

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

Paul Squires

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.



    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))

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer