Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Datepicker start of week (New Zealand)

16 views
Skip to first unread message

Saga

unread,
May 9, 2006, 2:49:28 PM5/9/06
to

Hi all!

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


Rick Rothstein

unread,
May 9, 2006, 3:03:33 PM5/9/06
to

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

unread,
May 9, 2006, 3:34:46 PM5/9/06
to
Understood, thanks rick :-)

Saga


"Rick Rothstein" <rickNOS...@NOSPAMcomcast.net> wrote in message
news:Oj2%23Ft5cG...@TK2MSFTNGP03.phx.gbl...

MikeD

unread,
May 9, 2006, 7:28:47 PM5/9/06
to

"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


Saga

unread,
May 10, 2006, 12:50:34 PM5/10/06
to
Thanks Mike!
Saga

"MikeD" <nob...@nowhere.edu> wrote in message
news:ulIFMB8c...@TK2MSFTNGP02.phx.gbl...

0 new messages