When I display the calendar in the date picker, the days go from Sun
through
Saturday, but in New Zealand, they are from Monday to Sunday. Is there
any way to configure the date picker so that the dropdown calendar will
follow this convention?
Thanks!
Saga
To the best of my knowledge, no, the DatePicker control does not provide for
this. However, if you are willing to "build your own" date picker, you can
use the MonthView control to display the calendar... it has a StartOfWeek
property that will alter its appearance the way you want.
Rick
Saga
"Rick Rothstein" <rickNOS...@NOSPAMcomcast.net> wrote in message
news:Oj2%23Ft5cG...@TK2MSFTNGP03.phx.gbl...
Actually, you can do it with a DTPicker using the Win32 API. The DTPicker
uses an actual MonthView control, so.....
-----BEGIN CODE
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any) As Long
Private Const MCM_FIRST As Long = &H1000&
Private Const MCM_SETFIRSTDAYOFWEEK As Long = (MCM_FIRST + 15)
Private Const DTM_FIRST As Long = &H1000&
Private Const DTM_GETMONTHCAL As Long = (DTM_FIRST + 8)
Private Sub DTPicker1_DropDown()
Dim hMonthview As Long
'Get hwnd of MonthView control
hMonthview = SendMessage(DTPicker1.hwnd, DTM_GETMONTHCAL, 0&, ByVal 0&)
'Set first day of week for MonthView, according to the following:
' Value Day of Week
' 0 Monday
' 1 Tuesday
' 2 Wednesday
' 3 Thursday
' 4 Friday
' 5 Saturday
' 6 Sunday
Call SendMessage(hMonthview, MCM_SETFIRSTDAYOFWEEK, 0&, ByVal 0&) 'first
day of week = Monday
End Sub
-----END CODE
Note that you must (and can only) do this in the DropDown event because
prior to that, the MonthView control doesn't exist. The MonthView gets
destroyed after the CloseUp event.
Oh...the value for the first day of week is the lParam of SendMessage (the
wParam is always 0). <g>
The above code was tested using VB6 SP5 under WinXP SP2 w/IE6 and all its
latest updates. The version of mscomct2.ocx was 6.0.88.4.
--
Mike
Microsoft MVP Visual Basic
"MikeD" <nob...@nowhere.edu> wrote in message
news:ulIFMB8c...@TK2MSFTNGP02.phx.gbl...