Hi
I'm attempting the following code to calculate how many quarters, dimes, nickels and pennies a user should get as change, and display them in four labels, when buying an item from a machine. The user inserts the amount paid and the cost of the item in two textboxes.
My code is as follows:
Code:
 
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
        ' Variables for fields
        Dim lblCost As Double = CDbl(txtCostItm.Text)
        Dim lblAmnt As Double = CDbl(txtAmntGvn.Text)


        ' Find Difference between Cost of Item and Price Received
        Dim temp As Double = txtAmntGvn.Text - txtCostItm.Text

        'Declare Integers

        Dim lblQuar As Integer
        Dim lblDim As Integer
        Dim lblNick As Integer
        Dim lblPenn As Integer

      


        'How many quarters will be handed
        lblQuar = CInt(temp / 25)
        temp = temp - CDbl(CDbl(lblQuar) * 25)
        lblQrts.Text = lblQuar.ToString

        'Dimes 
        lblDim = CInt(temp / 10)
        temp = temp - CDbl(CDbl(lblDim) * 10)
        lblDimes.Text = lblDim.ToString

        'Nickels 
        lblNick = CInt(temp / 5)
        temp = temp - CDbl(CDbl(lblNick) * 5)
        lblNckls.Text = lblNick.ToString

        'Pennies
        lblPenn = CInt(temp / 1)
        temp = temp - CDbl(CDbl(lblPenn) * 1)
        lblPennies.Text = lblPenn.ToString
I cant understand where I'm going wrong... anyone?!
Thanks a lot, in advance.