0 Replies - 1503 Views - Last Post: 18 March 2013 - 04:03 AM Rate Topic: -----

#1 folashadeshodunke  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-March 13

Eddie's Equipment Rental in Visual Basic 2008

Posted 18 March 2013 - 04:03 AM

I want to write a program in Visual Basic 2008 for a table that gives the price schedule for Eddie’s Equipment Rental.
F = Full-day rentals cost and H = one-and-a-half times half-day rentals.
Table
Piece of Equipment Half-Day Full-Day
1. Rug Cleaner $16.00 $24.00
2. Lawn mower $12.00 $18.00
3. Paint sprayer $20.00 $30.00
Write a program that displays the information from the table in list box when
an appropriate button is clicked and displays a bill in another list box based
on the item number and time period chosen by a customer. The bill should
include a $30.00 deposit.

I have a single form ("Form1"), with the following controls:

2 listboxes; 2 textboxes for (F & H) & for (item 1,2,3); 2 labels to select items and Durations; 2 buttons to display rental rates and to display customer bills. MY Codes Are"

[Codes] Private Sub MA_btn_Rental_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MA_btn_Rental.Click
'these codes will display te rental rates of the equipment
MA_lstb_Display.Items.Clear()
MA_lstb_Select.Items.Clear()
MA_lstb_Display.Items.Add("Price of Equipment" & vbTab & "Half-day" & vbTab & "Full-day")
MA_lstb_Display.Items.Add("1. Rug cleaner" & vbTab & vbTab & "$16.00" & vbTab & vbTab & "$24.00")
MA_lstb_Display.Items.Add("2. Lawn mower" & vbTab & vbTab & "$12.00" & vbTab & vbTab & "$18.00")
MA_lstb_Display.Items.Add("3. Paint sprayer" & vbTab & "$20.00" & vbTab & vbTab & "$30.00")
End Sub
Private Sub MA_btn_Customer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MA_btn_Customer.Click
'These codes will display the customer selection of equipment, price and the bill
Select Case MA_txt_Item.Text
Case Is = 1
MA_lstb_Select.Items.Add("Receipt from Eddie's Equipment Rental" & " " & vbCrLf & vbCrLf)
MA_txt_Item.Text = CStr("1")
MA_txt_Duration.Text = CStr("F")
MA_lstb_Select.Items.Add(CStr("Rug cleaner" & vbTab & "$24.00" & vbTab & "(Full-day rental)" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Deposit" & vbTab & vbTab & "$30.00 " & "" & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Total" & vbTab & vbTab & "$54.00"))
Case Is = 2
MA_lstb_Select.Items.Add("Receipt from Eddie's Equipment Rental" & " " & vbCrLf & vbCrLf)
MA_txt_Item.Text = 2
MA_txt_Item.Text = "2"
MA_txt_Duration.Text = CStr("F")
MA_lstb_Select.Items.Add(CStr("Lawn mower" & vbTab & "$18.00" & vbTab & "(Full-day rental)" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Deposit" & vbTab & vbTab & "$30.00 " & "" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Total" & vbTab & vbTab & "$48.00"))
Case Is = 3
MA_lstb_Select.Items.Add("Receipt from Eddie's Equipment Rental" & "" & vbCrLf & vbCrLf)
MA_txt_Item.Text = 3
MA_txt_Item.Text = CStr("3")
MA_txt_Duration.Text = CStr("F")
MA_lstb_Select.Items.Add(CStr("Paint sprayer" & vbTab & "$30.00" & vbTab & "(Full-day rental)" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Deposit" & vbTab & vbTab & "$30.00 " & "" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Total" & vbTab & vbTab & "$60.00"))
Case Is = 1
MA_lstb_Select.Items.Add("Receipt from Eddie's Equipment Rental" & " " & vbCrLf & vbCrLf)
MA_txt_Item.Text = CStr("1")
MA_txt_Duration.Text = CStr("H")
MA_lstb_Select.Items.Add(CStr("Rug cleaner" & vbTab & "$16.00" & vbTab & "(Half-day rental)" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Deposit" & vbTab & vbTab & "$30.00 " & "" & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Total" & vbTab & vbTab & "$46.00"))
MA_lstb_Select.Items.Add("Receipt from Eddie's Equipment Rental" & " " & vbCrLf & vbCrLf)
Case Is = 2
MA_txt_Item.Text = 2
MA_txt_Item.Text = "2"
MA_txt_Duration.Text = CStr("H")
MA_lstb_Select.Items.Add(CStr("Lawn mower" & vbTab & "$12.00" & vbTab & "(Half-day rental)" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Deposit" & vbTab & vbTab & "$30.00 " & "" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Total" & vbTab & vbTab & "$42.00"))
MA_lstb_Select.Items.Add("Receipt from Eddie's Equipment Rental" & "" & vbCrLf & vbCrLf)
Case Is = 3
MA_txt_Item.Text = 3
MA_txt_Item.Text = CStr("3")
MA_txt_Duration.Text = CStr("H")
MA_lstb_Select.Items.Add(CStr("Paint sprayer" & vbTab & "$20.00" & vbTab & "(Half-day rental)" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Deposit" & vbTab & vbTab & "$30.00 " & "" & vbCrLf & vbCrLf))
MA_lstb_Select.Items.Add(CStr("Total" & vbTab & vbTab & "$50.00"))
End Select
End Sub [Code]

the Problem I am encontering are:

1. I want to align the amounts to the right.
2. I want to leave a line space between the receipt & equipment & between the deposit & total in the second listbox.
3. All the Half-day information is displaying as Full-day.
4. I want to write the validation codes of MA_txt_Item (such as a message box titled Error Item with the message "The Item must be a number.

I have to submit this assignment today and I will appreciate your help.

Thank you very much

Margaret

Is This A Good Question/Topic? 0
  • +

Page 1 of 1