datepicker - If Statements

Page 1 of 1

12 Replies - 6439 Views - Last Post: 14 November 2008 - 02:28 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=70978&amp;s=4af47b83ec9f9940578711160b5fb28a&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

datepicker - If Statements

Posted 08 November 2008 - 10:56 AM

I figured out to calculate two dates DAYS from each other..

But how do you write the IF statement so that if the day you picked before the date you checked in, it throws a flag?

I know it would be something like

If d1 < Current time... (I cant figure out the current time bit)

```Private Sub DateTimeCheckOutPicker_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimeCheckOutPicker.ValueChanged
'Calculate the number of days the guest is staying at the hotel.
Dim d1, d2 As Date
d1 = Me.DateTimeCheckInPicker.Value  'Sets d1 as Check In date
d2 = Me.DateTimeCheckOutPicker.Value 'd2 as Checkout Date
If d1 > d2 Then
MessageBox.Show("Error, Check in date must be before checkout")
Me.DateTimeCheckInPicker.Focus()
Else
strNumberofnights = CStr(d2.Subtract(d1).Days) ' Compares two dates and subracts the days
End If
```

Is This A Good Question/Topic? 0

Replies To: datepicker - If Statements

#2 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 08 November 2008 - 12:20 PM

Also, Since I am using DatePicker to checkin people, and datepicker to checkout picker, how can I make DatePickerCheckIn to accept the current date if the DatePickerCheckIn value IS NOT changed?

#3 Pwn

• D.I.C Regular

Reputation: 19
• Posts: 458
• Joined: 25-November 07

Re: datepicker - If Statements

Posted 08 November 2008 - 02:07 PM

datepicker should have a min and max value, just set the min value to today, you should be good.
Also, it should default to today's date, so if you just get the value it should be today.

This post has been edited by Pwn: 08 November 2008 - 02:09 PM

#4 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 08 November 2008 - 02:48 PM

Pwn, on 8 Nov, 2008 - 01:07 PM, said:

datepicker should have a min and max value, just set the min value to today, you should be good.
Also, it should default to today's date, so if you just get the value it should be today.

How would I type that? I don't know that code

#5 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 08 November 2008 - 03:05 PM

Got it..

DateTimeCheckInPicker.MinDate = dtmSystemDate
DateIN = DateTimeCheckInPicker.Value
If DateIN > dtmSystemDate Then
MessageBox.Show("Dubmass")

#6 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 08 November 2008 - 03:19 PM

4x4pirate, on 8 Nov, 2008 - 02:05 PM, said:

Got it..

DateTimeCheckInPicker.MinDate = dtmSystemDate
DateIN = DateTimeCheckInPicker.Value
If DateIN > dtmSystemDate Then
MessageBox.Show("Dubmass")

How do I set the minimum on DateTimeCheckOutPicker.MinDate = dtmSystemDate (PLUS ONE DAY)

#7 Pwn

• D.I.C Regular

Reputation: 19
• Posts: 458
• Joined: 25-November 07

Re: datepicker - If Statements

Posted 08 November 2008 - 04:05 PM

4x4pirate, on 8 Nov, 2008 - 02:19 PM, said:

How do I set the minimum on DateTimeCheckOutPicker.MinDate = dtmSystemDate (PLUS ONE DAY)

#8 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 08 November 2008 - 04:12 PM

Pwn, on 8 Nov, 2008 - 03:05 PM, said:

4x4pirate, on 8 Nov, 2008 - 02:19 PM, said:

How do I set the minimum on DateTimeCheckOutPicker.MinDate = dtmSystemDate (PLUS ONE DAY)

thanks!!

#9 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 08 November 2008 - 04:25 PM

nope.. didnt work.. throws an unhandled exception..

#10 dbasnett

Reputation: 121
• Posts: 670
• Joined: 01-October 08

Re: datepicker - If Statements

Posted 09 November 2008 - 04:49 PM

#11 4x4pirate

Reputation: 0
• Posts: 54
• Joined: 18-October 06

Re: datepicker - If Statements

Posted 09 November 2008 - 07:09 PM

dbasnett, on 9 Nov, 2008 - 03:49 PM, said:

Solved.. thanks for the help!!

#12 justAgal

Reputation: 0
• Posts: 15
• Joined: 24-September 08

Re: datepicker - If Statements

Posted 12 November 2008 - 09:53 PM

Wait a minute....was that message "Dumbass"? Hope this wasn't an assignment

4x4pirate, on 9 Nov, 2008 - 06:09 PM, said:

dbasnett, on 9 Nov, 2008 - 03:49 PM, said:

Solved.. thanks for the help!!

#13 Pwn

• D.I.C Regular

Reputation: 19
• Posts: 458
• Joined: 25-November 07

Re: datepicker - If Statements

Posted 14 November 2008 - 02:28 PM

no, it was dubmass, so he's fine