Public Class Form1
Private amount As Double
Private total As Double
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim number As Integer
Double.TryParse(txtPriceItem.Text, amount)
Integer.TryParse(txtNumber.Text, number)
Dim subTotal As Double = number * amount
Dim VAT As Double = subTotal * 0.15
total = subTotal + VAT
txtVAT.Text = VAT.ToString("N2")
txtTotal.Text = total.ToString("N2")
btnCalculateChange.Enabled = True
End Sub
Private Sub btnCalculateChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateChange.Click
Double.TryParse(txtAmount.Text, amount)
Dim change As Double = amount - total
txtChange.Text = change.ToString("N2")
End Sub
End Class
Comments
Leave a comment