Back to Examples
Public Class frmRentalCost

  Private Sub btnRentalRates_Click(sender As Object, e As EventArgs) Handles btnRentalRates.Click
    lstPrices.Items.Clear()
    lstPrices.Items.Add(“Price of Equipment Half-day Full-day”)
    lstPrices.Items.Add(“1.Rug cleaner $16.00 $24.00”)
    lstPrices.Items.Add(“2.Lawn mower $12.00 $18.00”)
    lstPrices.Items.Add(“3.Paint sprayer $20.00 $30.00”)
  End Sub

  Private Sub btnCustomerBill_Click(sender As Object, e As EventArgs) Handles btnCustomerBill.Click
    Dim strItem As String = txtItem.Text
    Dim strDuration As String = txtDuration.Text
    Dim strCost As String = “Not a Valid Selection”
    Dim intTotal As Integer
    lstReceipt.Items.Clear()

    If strItem = “1” Then

      If strDuration = “H” Or strDuration = “h” Then
        strCost = “Rug cleaner: $16.00 (Half-day rental)”
        intTotal = 46
      ElseIf strDuration = “F” Or strDuration = “f” Then
        strCost = “Rug cleaner: $24.00 (Full-day rental)”
        intTotal = 54
      Else
        MessageBox.Show(“Please enter a valid duration”)
      End If

    ElseIf strItem = “2” Then

      If strDuration = “H” Or strDuration = “h” Then
        strCost = “Lawn mower: $12.00 (Half-day rental)”
        intTotal = 42
      ElseIf strDuration = “F” Or strDuration = “f” Then

        strCost = “Lawn mower: $18.00 (Full-day rental)”
        intTotal = 48
      Else

        MessageBox.Show(“Please enter a valid duration”)
      End If

    ElseIf strItem = “3” Then

      If strDuration = “H” Or strDuration = “h” Then
        strCost = “Paint sprayer: $20.00 (Half-day rental)”
        intTotal = 50
      ElseIf strDuration = “F” Or strDuration = “f” Then

        strCost = “Paint sprayer: $30.00 (Full-day rental)”
        intTotal = 60
      Else

        MessageBox.Show(“Please enter a valid duration”)
      End If

    Else
      MessageBox.Show(“Please enter a valid item number.”)
    End If

    lstReceipt.Items.Add(“Receipt from Eddie’s Equipment Rental”)
    lstReceipt.Items.Add(“”)
    lstReceipt.Items.Add(strCost)
    lstReceipt.Items.Add(“Deposit: $30.00”)
    lstReceipt.Items.Add(“”)
    lstReceipt.Items.Add(“Total: $” & intTotal & “.00”)

  End Sub

End Class
Back to Examples

Startup Discount
Small Business?
Contact us for an Enormous Discount!