Public Structure SYSTEMTIME Dim wYear As Integer Dim wMonth As Integer Dim wDayOfWeek As Integer Dim wDay As Integer Dim wHour As Integer Dim wMinute As Integer Dim wSecond As Integer Dim wMilliseconds As Integer End Structure Public Declare Function SendMessage Lib "user32.dll" _ Alias "SendMessageA" _ (ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Integer, ByVal lParam As SYSTEMTIME) As IntPtr Public Const DTM_SETRANGE = &H1004& Public Const GDTR_MIN = 1 Public Const GDTR_MAX = 2 Dim TimeArray(1) As SYSTEMTIME Dim result As IntPtr 'Dim trdt As Date ' Define first minimum date. TimeArray(0).wDay = Format(dt, "dd") TimeArray(0).wMonth = Format(dt, "MM") TimeArray(0).wYear = Format(dt, "yyyy") ' Define second maximum date. TimeArray(1).wDay = Format(Dt1, "dd") TimeArray(1).wMonth = Format(Dt1, "MM") TimeArray(1).wYear = Format(Dt1, "yyyy") result = SendMessage(Me.dtpFrom.Handle, DTM_SETRANGE, GDTR_MIN + GDTR_MAX, TimeArray(0))
Me.dtpFrom.MinDate = dt Me.dtpFrom.MaxDate = dt1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)