Im trying to get a sales percentage program to work and im having trouble on the last part. My homework is to get the original price from the customer and then take the sales percentage off and show how much it is. Then after the first percentage is off take an additional percentage off part and then show the grand total. I got all the way up to the additional percentage off part to work right. I dont understand why I cant add an additional percentage of and the program wont recognize it and work right. Can someone help me

Public Class Form1
    Dim Num1 As Integer
    Dim Num2 As Integer
    Dim Num3 As Integer
    Dim Num4 As Integer
    Dim Num5 As Integer
    Dim sales As Integer
    Dim answer As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        
        Num1 = TextBoxNum1.Text
        Num2 = TextBoxNum2.Text
        Num4 = Num2 / 0.01
        sales = Num4 / Num1
        Labelsale.Text = sales
        Num3 = TextBoxNum3.Text
        Num5 = 0.01 / Num3
        answer = Num5 / sales
        Labelanswer.Text = answer

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()
    End Sub
End Class

Thank you

Recommended Answers

All 3 Replies

which line is creating problem for you ?

well its not really causing a problem for certain its just not running right, I think the problem has to be on the line 17-19 somewhere. The first part of the code runs fine, it produces the right answer, but after I add the additional percentage of, it gives a completely wrong number. I dont know why it wont produce the right answer.

Firstly, I have asked the mods to move this to vb.Net. You will not get much help here in the vb4/5/6 forum.:)

Secondly,Your devisions does not look right.

If you want to say take 10% of an amount, you would get the percentage amount as in -

Amount100 = AmountPercent * 10/100
AmountResult = Amount100 - AmountPercent
'Amount is 100, 10 is returned, balance = 90

Something along these lines. Basically multiply the amount by the percentage and then devide by 100 to get the amount to be deducted from the original amount.:)

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.