Date/Time Picker (VB6)

Is there any way to change the default starting day in the drop down calendar.
I tried setting the dayofweek but this didn't work.
When I drop down the calendar the first day is a Monday, I would prefer it to be a Sunday.
annandapAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SLECommented:
I don't think this is possible.
0
ventondCommented:
Two possible solutions:
1) The control that the DTPicker uses is called MonthView, it has this setting; "StartofWeek". Perhaps you can find a way of using this control.
2) Find a way of sending a message to the MonthView control within the dtpicker, Which I can't help you with.
0
TimCotteeHead of Software ServicesCommented:
I don't think you can do this either, you could use the monthview control which has a startofweek property that you can set to 1 (sunday) you could use this in conjunction with a combobox to provide similar functionality.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

twardCommented:
This will do it, but it will also change the text in the combobox:

Form1.DTPicker1.Day = "12"
Form1.DTPicker1.Refresh
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TimCotteeHead of Software ServicesCommented:
tward, I just though I would try this but all it does is the obvious, sets the preselected day as the 12th of the current month.
0
twardCommented:
That is what I said in my answer..  I haven't tried the CCRP Control replacement for this, but it may do it:

http://www.mvps.org/ccrp/
0
TimCotteeHead of Software ServicesCommented:
I had forgotten about the ccrp version. This does have a first day of week option which will provide the required function. Thanks tward for reminding me. I downloaded them a while back but forgot to look at it.
0
twardCommented:
Here is how you can do it with the VB Date Time Picker:

Public Const DTM_FIRST        As Integer = &H1000
Public Const DTM_GETMONTHCAL As Integer = (DTM_FIRST + 8)

Public Const MCM_FIRST           As Integer = &H1000
Public Const MCM_SETFIRSTDAYOFWEEK As Integer = (MCM_FIRST + 15)

Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Sub DTPicker1_DropDown()
 
  Dim hwnd As Long
 
  hwnd = SendMessageLong(Form1.DTPicker1.hwnd, DTM_GETMONTHCAL, 0, 0)

  Call SendMessageLong(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, 0)
 
End Sub

**** The Second 0 in the Second SendMessageLong call sets the Day of Week 0 = Monday,1 = Tuesday.... 6 = Sunday.
0
twardCommented:
Here is how you can do it with the VB Date Time Picker:

Public Const DTM_FIRST        As Integer = &H1000
Public Const DTM_GETMONTHCAL As Integer = (DTM_FIRST + 8)

Public Const MCM_FIRST           As Integer = &H1000
Public Const MCM_SETFIRSTDAYOFWEEK As Integer = (MCM_FIRST + 15)

Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Sub DTPicker1_DropDown()
 
  Dim hwnd As Long
 
  hwnd = SendMessageLong(Form1.DTPicker1.hwnd, DTM_GETMONTHCAL, 0, 0)

  Call SendMessageLong(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, 0)
 
End Sub

**** The Second 0 in the Second SendMessageLong call sets the Day of Week 0 = Monday,1 = Tuesday.... 6 = Sunday.
0
annandapAuthor Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.