I am learning vb and one of my projects is to make a price schedule using full day and half day rates as well as adding a deposit, etc. I don't want you to tell me what to do just please what I am missing. I haven't been able to get it to run but if I can I can salvage some points. Thank you in advance..

Public Class frmEddies

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblDuration.Click

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnRates_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRates.Click

      

        'Display rates for given items per length of time rented.

        Dim item, duration As String
        Dim deposit As String
        item = txtItem.Text
        duration = txtDuration.Text
        deposit = CStr(30.0)

        Dim fmtStr As String = "{0,-22}{1,12} {2,12}"
        lstRates.Items.Clear()
        lstRates.Items.Add(String.Format(fmtStr, "Price of Equipment", "Half-day", "Full-day"))
        lstRates.Items.Add(String.Format(fmtStr, "1. Rug cleaner", "$16.00", "$24.00"))
        lstRates.Items.Add(String.Format(fmtStr, "2. Lawn mower", "$12.00", "$18.00"))
        lstRates.Items.Add(String.Format(fmtStr, "3. Paint Sprayer", "$20.00", "$30.00"))
        

       
    End Sub

    Private Sub btnBill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBill.Click
        'Shows total bill.

        Dim item, duration, deposit As String
        item = txtItem.Text
        duration = txtDuration.Text
        deposit = CStr(30.0)
      
        Dim fmtStr As String = "{0,-20}{1, 10}{2, 10} "
        lstBill.Items.Clear()
        lstBill.Items.Add("Receipt from Eddie's Equipment Rental")
        'Program will not run past this point....
        Select Case duration + deposit + item
            Case "1H"
                lstBill.Items.Add("Rug cleaner" & "$16.00 ")
                lstBill.Items.Add("Deposit" & "$30.00")
                lstBill.Items.Add("Total" = duration + item)
            Case "1F"
                lstBill.Items.Add("Rug cleaner" & "$24.00 " & "Deposit" & "$30.00" & "Total" = duration + item)
            Case "2H"
                lstBill.Items.Add("Lawn mower" & "$12.00 " & "Deposit" & "$30.00" & "Total" = duration + item)
            Case "2F"
                lstBill.Items.Add("Lawn mower" & "$18.00 " & "Deposit" & "$30.00" & "Total" = duration + item)
            Case "3H"
                lstBill.Items.Add("Paint sprayer" & "$20.00 " & "Deposit" & "$30.00" & "Total" = duration + item)
            Case "3F"
                lstBill.Items.Add("Paint sprayer" & "$30.00 " & "Deposit" & "$30.00" & "Total" = duration + item)

        End Select
    End Sub
End Class

whoops I just realized I posted this in the middle of trying to fix it (thats why 1H is different then the rest..)

Wrong forum!!!

MWillis, Sorry, I got no magic bullets but I might be able to help a little bit. It's tough trying to understand what you are doing here. Over-simplifying the code structure and naming convensions really helps. Some thoughts:
1) This is the Visual Basic 4/5/6 section. Your code is for VB.NET. But hey, whatever.
2) Move your declarations (dim) to the top of each routine.
3) Use '&' to concatenate strings. Use '+' for math. Using '+' for both never confuses the compiler, just the programmer.
line 46. duration + deposit + item
These are strings, so if: duration="1", deposit="20.00", item="1"
The result is "120.001"
4) Select Case statements are selected on exact matches
so the first 'case' (line 47) will be run if the concatenated string duration & deposit & item = "1H". I don't see right off how that would ever happen.
Looks like duration can be "F" or "H" (full or half)
Looks like item can be 1,2,3, or 4
Looks like deposit is always the same
Try the Switch like
Switch Case item & duration
This results in values like "1H" or "2F"
And be careful of case (make sure you enter all upper case, or convert the input to uppercase before the swtch)
5) line 48. "Rug cleaner" & "$16.00 " is the same as "Rug cleaner$16.00". Your probably want a space or something in the middle.

Hope that helps a little. Good luck.

Thank you for your help.I didn't know this was vb.net, just have a textbook that says Visual Basics 2008. I am so lost anyway. Thank you for your pointers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.