0
Private sub btnCompute_click () handles btnCompute.click

Dim Total, labor, customer As String

labor = cdbl(txthour.text * 35)
parts = cdbl(txtpart.text + 5%)
Total = labor + parts
customer = txtname.text
lstResult.Items.add.clear()
lstResult.Items.add("customer" & customer)
lstResult.Items.add("Labor cost" & Labor)
lstResult.Items.add("Parts Cost" & Parts)
lstResult.Items.add(" Total Cost" & Total)

end sub

*******************************************
THANKS IN ADVANCE

Edited by WaltP: Added CODE tags -- with all the help about them, how could you miss using them????

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by NeilClayton
0

If i may ask
What you i enter when trying to put a Percent sign?

Thank you

0

Hi

I think this is how i would write it:

Dim customer As String
Dim TOTAL, parts, labor As Double

        labor = CDbl(Txthour.Text * 35)
        parts = CDbl(Txtpart.Text + 5)
        Total = labor + parts
        customer = txtname.text
        lstResult.Items.Clear()
        lstResult.Items.add("customer" & customer)
        lstResult.Items.add("Labor cost" & labor)
        lstResult.Items.add("Parts Cost" & Parts)
        lstResult.Items.add(" Total Cost" & Total)

I think the variables: Total,Parts and Labor should be Double type.
A string type would concatenate the values Labor + Parts instead of adding them.


Also you cant add and clear a listitem in the same command.
lstResult.Items.Clear()
I hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.