I am creating some calculators for my Comp107 class and ran into an issue I seem to have trouble understanding.
I built a calculator to figure sales tax, then add the tax to the sales amount for a total. I put the calculations under one button. It works, but only gives the tax on the first click (it repeats the sales amount in the total label on the first click). I have to click it twice to get the actual total in the total label. Not knowing what I'm doing (a very new student) I just gave up and made separate buttons for the tax and total functions. Below is what I had before I went with two buttons. Can you not do to arithmetic operations under one button?
Public Class Calculator
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
Dim lblAmtSale As Integer
Dim lblSTR As Integer
Dim lblTaxAmt As Integer
Dim lblTotal As Integer
lblAmtSale = Val(txtAmtSale.Text)
lblSTR = Val(txtTaxRate.Text)
lblTaxAmt = Val(lblTax.Text)
lblTotal = Val(lblTotAmt.Text)
lblTax.Text = lblAmtSale * (lblSTR / 100)
lblTotAmt.Text = lblAmtSale + lblTaxAmt
I'm sure I have excess material in my code. Newbie....
Thanks.