Home All Groups Group Topic Archive Search About

what method to use to add 1 day to a date (hotel reservation for one night by clicking on calender)

Author
10 Oct 2006 5:06 AM
Amanda
here is my code; see ????


Private Sub dtmMonthCalendar1_MouseLeave(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles dtmMonthCalendar1.MouseLeave

    mdatArrivalDate = dtmMonthCalendar1.SelectionStart
    txtArrivalDate.Text = mdatArrivalDate

    If dtmMonthCalendar1.CanSelect Then
      txtDepartureDate.Text = dtmMonthCalendar1.SelectionEnd
      txtNightStayed.Text = (dtmMonthCalendar1.SelectionEnd _
        - dtmMonthCalendar1.SelectionStart).TotalDays
    Else
      txtDepartureDate.Text = ????
      txtNightStayed.Text = "1"
    End If '

     mshrNightStayed = Val(txtNightStayed.Text)
    dtmMonthCalendar1.Hide()

End Sub

Author
10 Oct 2006 5:24 AM
Cor Ligthert [MVP]
Amanda,

By instance
mdatArrivalDate = mdatArrivalDate.AddDays(1)

http://msdn2.microsoft.com/en-us/library/system.datetime.adddays.aspx

I hope this helps,

Cor

Show quoteHide quote
"Amanda" <amanda772***@yahoo.com> schreef in bericht
news:1160456789.020507.168180@m7g2000cwm.googlegroups.com...
> here is my code; see ????
>
>
> Private Sub dtmMonthCalendar1_MouseLeave(ByVal sender As Object, _
>    ByVal e As System.EventArgs) Handles dtmMonthCalendar1.MouseLeave
>
>    mdatArrivalDate = dtmMonthCalendar1.SelectionStart
>    txtArrivalDate.Text = mdatArrivalDate
>
>    If dtmMonthCalendar1.CanSelect Then
>      txtDepartureDate.Text = dtmMonthCalendar1.SelectionEnd
>      txtNightStayed.Text = (dtmMonthCalendar1.SelectionEnd _
>        - dtmMonthCalendar1.SelectionStart).TotalDays
>    Else
>      txtDepartureDate.Text = ????
>      txtNightStayed.Text = "1"
>    End If '
>
>     mshrNightStayed = Val(txtNightStayed.Text)
>    dtmMonthCalendar1.Hide()
>
> End Sub
>
Author
10 Oct 2006 5:52 AM
Amanda
Cor Ligthert [MVP] wrote:
> Amanda,
>
> By instance
> mdatArrivalDate = mdatArrivalDate.AddDays(1)

Yeah, I needed to assign to a date variable and then call AddDays.  I
was hoping that I could just do it diretcly to calender.SelectionEnd.

Thanks


Show quoteHide quote
>
> http://msdn2.microsoft.com/en-us/library/system.datetime.adddays.aspx
>
> I hope this helps,
>
> Cor
>
> "Amanda" <amanda772***@yahoo.com> schreef in bericht
> news:1160456789.020507.168180@m7g2000cwm.googlegroups.com...
> > here is my code; see ????
> >
> >
> > Private Sub dtmMonthCalendar1_MouseLeave(ByVal sender As Object, _
> >    ByVal e As System.EventArgs) Handles dtmMonthCalendar1.MouseLeave
> >
> >    mdatArrivalDate = dtmMonthCalendar1.SelectionStart
> >    txtArrivalDate.Text = mdatArrivalDate
> >
> >    If dtmMonthCalendar1.CanSelect Then
> >      txtDepartureDate.Text = dtmMonthCalendar1.SelectionEnd
> >      txtNightStayed.Text = (dtmMonthCalendar1.SelectionEnd _
> >        - dtmMonthCalendar1.SelectionStart).TotalDays
> >    Else
> >      txtDepartureDate.Text = ????
> >      txtNightStayed.Text = "1"
> >    End If '
> >
> >     mshrNightStayed = Val(txtNightStayed.Text)
> >    dtmMonthCalendar1.Hide()
> >
> > End Sub
> >