Hi, i got a program im working on. it does some calculations using quantity and price in such. heres the calculation module.

Private Sub calculations()
        If AdultsizeRadioButton1.Checked = True Then
            adulttotaldecimal = quantityinteger * adultpricedecimal * hoursinteger

        ElseIf ChildsizeRadioButton2.Checked = True Then
            childtotaldecimal = quantityinteger * childpricedecimal * hoursinteger
        End If
        adultchildtotaldecimal = adulttotaldecimal + childtotaldecimal
        extendedpricedecimal = adultchildtotaldecimal * servicetaxdecimal
        accumwagonsrentedinteger += quantityinteger
        accumprofitdecimal += extendedpricedecimal
    End Sub

Ok, everything has worked when i display the information.... up until the accumprofitdecimal variable. When i display that value its NOT what it should be. For instance i'm putting in a quanity of 1 and an hour of 1 for an adult then for a child, the extended price comes out properly as $2.15 now the code accumprofitdecimal += extendedpricedecimal SHOULD add the extended price (2.15) to the accumulative total. but when i display the accum profit total it shows a number that makes zero sense... is accumprofitdecimal += extendedpricedecimal not correct code?

Also thhe initial value of accumprofitdecimal is 0.

Not sure if this helps, but try converting the Integers to Decimals.
CDec(hoursinteger)

Private Sub calculations()
        If AdultsizeRadioButton1.Checked = True Then
            adulttotaldecimal = quantityinteger * adultpricedecimal * CDec(hoursinteger)

        ElseIf ChildsizeRadioButton2.Checked = True Then
            childtotaldecimal = quantityinteger * childpricedecimal * CDec(hoursinteger)
        End If
        adultchildtotaldecimal = adulttotaldecimal + childtotaldecimal
        extendedpricedecimal = adultchildtotaldecimal * servicetaxdecimal
        accumwagonsrentedinteger += quantityinteger
        accumprofitdecimal += extendedpricedecimal
    End Sub

it did not workk:/

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.