vendredi 11 septembre 2020

selecting radio buttons and checkboxes to show total in a label?

This is my code at the moment. Can you please tell me what more to add to show total cost in a label when user selects random radio buttons and checkboxes?

windows application that helps the receptionist generate a quote for a hotel room sale for a family’s one night stay in the hotel. You have to choose an appropriate name for your application. The hotel has 3 types of rooms only and provides buffet breakfast and dinner for a fee. Apart from internet, entertainment and spa services, all other hotel amenities are free of charge.

Room Type = (radiobuttons) a.luxury $210 b. Superior $150 c. Standard $110 Meals (checkboxes) a. Breakfast $40 b. Dinner$60

Amenities (checkboxes) a. Internet$10 b. Entertainment – Pay movies$20 c. Spa Services$50 all these have constant prices ............................. the code below is what i have done till now. can you please help me out on how to display the total cost in the label

Public Class frmThePearlResortFiji

Private Sub frmThePearlResortFiji_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    lblDate.Text = Date.Now
End Sub

Private Sub btnTotalCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotalCost.Click

    lblTotalCost.Text = "YOU HAVE ORDERED:" & vbNewLine

    lblTotalCost.Text = lblTotalCost.Text & "ROOM TYPE" & vbNewLine & "--------" & vbNewLine

    If radLuxury.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Luxury = $210" & vbNewLine
    ElseIf radSuperior.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Superior = $150" & vbNewLine
    Else
        lblTotalCost.Text = lblTotalCost.Text & "Standard = $110" & vbNewLine
    End If

    lblTotalCost.Text = lblTotalCost.Text & vbNewLine & "MEAL OPTIONS" & vbNewLine & "--------" & vbNewLine

    If chkBufferBreakfast.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Buffer Breakfast = $40" & vbNewLine
    End If
    If chkBufferDinner.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Buffer Dinner = $60" & vbNewLine
    End If

    lblTotalCost.Text = lblTotalCost.Text & vbNewLine & "AMENITIES" & vbNewLine & "--------" & vbNewLine

    If chkInternet.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Internet = $10" & vbNewLine
    End If
    If chkEntertainment.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Entertainment = $20" & vbNewLine
    End If
    If chkSpaServices.Checked Then
        lblTotalCost.Text = lblTotalCost.Text & "Spa Services = $50" & vbNewLine
    End If

    lblTotalCost.Text = decLuxury + decSuperior + decStandard

    
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    Me.Close()
End Sub

Private Sub radLuxury_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radLuxury.CheckedChanged
    picSuperior.Visible = False
    picStandard.Visible = False
    picLuxury.Visible = True

End Sub

Private Sub radSuperior_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radSuperior.CheckedChanged
    picLuxury.Visible = False
    picStandard.Visible = False
    picSuperior.Visible = True
End Sub

Private Sub radStandard_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radStandard.CheckedChanged
    picSuperior.Visible = False
    picLuxury.Visible = False
    picStandard.Visible = True
End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    lblTotalCost.Text = ""
    radLuxury.Checked = False
    radSuperior.Checked = False
    radStandard.Checked = False

    chkBufferBreakfast.Checked = False
    chkBufferDinner.Checked = False

    chkEntertainment.Checked = False
    chkInternet.Checked = False
    chkSpaServices.Checked = False

    picLuxury.Image = Nothing
    picSuperior.Image = Nothing
    picStandard.Image = Nothing

End Sub

End Class




Aucun commentaire:

Enregistrer un commentaire