-
July 15th, 2012, 02:35 PM
#1
Help needed with DateTimePicker???
The only part of my project that is not working is the DateTimePickerArrival and DateTimePickerDeparture. I'm trying to add a 10% High Season Rate for the months December-February. Right now it is adding the tax to all days. Any help would be appreciated. Thanks!
HTML Code:
Public Sub SetMyCustomFormat()
' Set the Format type and the CustomFormat string.
DateTimePickerArrival.Format = DateTimePickerFormat.Custom
DateTimePickerArrival.CustomFormat = "MM dd, yyyy"
DateTimePickerDeparture.Format = DateTimePickerFormat.Custom
DateTimePickerDeparture.CustomFormat = "MM dd, yyyy"
End Sub
HTML Code:
Private Sub AccommodationsTotalButton_Click(sender As System.Object, e As System.EventArgs)Handles AccommodationsTotalButton.Click
Dim StudioDecimal, OneBedroomDecimal, TwoBedroomDecimal, ThreeBedroomDecimal As Decimal
Dim DateTimePicker As Date
'Find the price.
If StudioRadioButton.Checked Then
StudioDecimal = STUDIO_OFF_Decimal
ElseIf OneBedroomRadioButton.Checked Then
OneBedroomDecimal = ONE_BEDROOM_CONDO_OFF_Decimal
ElseIf TwoBedroomRadioButton.Checked Then
TwoBedroomDecimal = TWO_BEDROOM_CONDO_OFF_Decimal
ElseIf ThreeBedroomRadioButton.Checked Then
ThreeBedroomDecimal = THREE_BEDROOM_CONDO_OFF_Decimal
ElseIf StudioOnRadioButton.Checked Then
StudioDecimal = STUDIO_ON_Decimal
ElseIf OneBedroomOnRadioButton.Checked Then
OneBedroomDecimal = ONE_BEDROOM_CONDO_ON_Decimal
ElseIf TwoBedroomOnRadioButton.Checked Then
TwoBedroomDecimal = TWO_BEDROOM_CONDO_ON_Decimal
ElseIf ThreeBedroomOnRadioButton.Checked Then
ThreeBedroomDecimal = THREE_BEDROOM_CONDO_ON_Decimal
End If
'Display the prices.
StudioTextBox.Text = CStr(StudioDecimal)
StudioTextBox.Text = StudioDecimal.ToString("C")
OneBedroomTextBox.Text = CStr(OneBedroomDecimal)
OneBedroomTextBox.Text = OneBedroomDecimal.ToString("C")
TwoBedroomTextBox.Text = CStr(TwoBedroomDecimal)
TwoBedroomTextBox.Text = TwoBedroomDecimal.ToString("C")
ThreeBedroomTextBox.Text = CStr(ThreeBedroomDecimal)
ThreeBedroomTextBox.Text = ThreeBedroomDecimal.ToString("C")
'Calculate the total Accommodation Price.
Dim AccommodationDecimal As Decimal = CDec(100.0) ' Amount = 100 $
Dim HIGH_SEASON_RATE_Decimal As Decimal = CDec(10.0) ' Rate = 10%
AccommodationDecimal = StudioDecimal + OneBedroomDecimal + TwoBedroomDecimal + ThreeBedroomDecimal
'Calculate the total Accommodation Price with High Season.
If DateTimePicker.Month < 3 OrElse DateTimePicker.Month > 11 Then
AccommodationDecimal = CDec(AccommodationDecimal + (HIGH_SEASON_RATE_Decimal * 0.01 * AccommodationDecimal))
End If
AccommodationsTotalTextBox.Text = AccommodationDecimal.ToString("C")
AccommodationDecimal = CDec(CDec(CDbl(AccommodationsTotalTextBox.Text) * CDbl(VacationDaysTextBox.Text)) * CDbl(NumberPeopleTextBox.Text))
TotalTextBox.Text = AccommodationDecimal.ToString("C")
End Sub
-
July 16th, 2012, 12:08 AM
#2
Re: Help needed with DateTimePicker???
Look at the return value for DateTimePicker.Month to see WHAT it is.
-
July 16th, 2012, 08:52 AM
#3
Re: Help needed with DateTimePicker???
DateTimePicker is a class. You shouldn't do this:
Code:
Dim DateTimePicker As Date
I'm trying to see if that variable is even assigned a value. If you have a control that's a DateTimePicker then you only need to reference it by its name (i.e. dtpReservationDate.Month)
-
July 16th, 2012, 10:55 AM
#4
Re: Help needed with DateTimePicker???
Thanks for the help...problem fixed!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|