Home All Groups Group Topic Archive Search About
Author
31 Mar 2006 10:57 AM
G .Net
Hi

Can anybody help me with setting the allowable Max and Min date for a
DatePicker?

I would like to restrict the possible date selections to a given month. So
for example, if I were to specify Jan 06 the datepicker could not display
days Feb 06 i.e. the arrows for next month and earlier month would not do
anything.

I understand that I could use DatePicker MinDate and MaxDate but how do I
set these without explicitly setting, for example, 01/01/06 - 31/01/06.

Thanks in advance

Geoff

Author
31 Mar 2006 1:27 PM
Larry Lard
G .Net wrote:
> Hi
>
> Can anybody help me with setting the allowable Max and Min date for a
> DatePicker?
>
> I would like to restrict the possible date selections to a given month. So
> for example, if I were to specify Jan 06 the datepicker could not display
> days Feb 06 i.e. the arrows for next month and earlier month would not do
> anything.
>
> I understand that I could use DatePicker MinDate and MaxDate but how do I
> set these without explicitly setting, for example, 01/01/06 - 31/01/06.

' to restrict a DatePicker named dtp to the month of:
Dim month As Integer = 1
Dim year As Integer = 2006

        dtp.MinDate = New Date(year, month, 1)
        dtp.MaxDate = dtp.MinDate.AddMonths(1).AddDays(-1)

--
Larry Lard
Replies to group please
Author
1 Apr 2006 9:35 AM
G .Net
Hi Larry

Many thanks for that.

Geoff

Show quoteHide quote
"Larry Lard" <larryl***@hotmail.com> wrote in message
news:1143811641.063552.91390@i39g2000cwa.googlegroups.com...
>
> G .Net wrote:
>> Hi
>>
>> Can anybody help me with setting the allowable Max and Min date for a
>> DatePicker?
>>
>> I would like to restrict the possible date selections to a given month.
>> So
>> for example, if I were to specify Jan 06 the datepicker could not display
>> days Feb 06 i.e. the arrows for next month and earlier month would not do
>> anything.
>>
>> I understand that I could use DatePicker MinDate and MaxDate but how do I
>> set these without explicitly setting, for example, 01/01/06 - 31/01/06.
>
> ' to restrict a DatePicker named dtp to the month of:
> Dim month As Integer = 1
> Dim year As Integer = 2006
>
>        dtp.MinDate = New Date(year, month, 1)
>        dtp.MaxDate = dtp.MinDate.AddMonths(1).AddDays(-1)
>
> --
> Larry Lard
> Replies to group please
>