How can I add Tax on a simple calculator

how to add tax on a calculator

Posted 11 October 2009 - 07:43 PM

Hello I am new on Visual basic. I am doing a tutorial for a simple calculator. My question is how can I add code to make a botton that add my tax % to the total amount I have. This is the code I from the tutorial. Thanks a lot for the help and sorry with my english

Option Explicit On

Public Class Form1

Dim firstnumber As Single

Dim secondnumber As Single

Dim answernumber As Single

Dim arithmeticprocess As String

Private Sub cmd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd1.Click

Txtdisplay.Text = Txtdisplay.Text & "1"

End Sub

Private Sub cmd2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd2.Click

Txtdisplay.Text = Txtdisplay.Text & "2"

End Sub

Private Sub cmd3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd3.Click

Txtdisplay.Text = Txtdisplay.Text & "3"

End Sub

Private Sub cmd4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd4.Click

Txtdisplay.Text = Txtdisplay.Text & "4"

End Sub

Private Sub cmd5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd5.Click

Txtdisplay.Text = Txtdisplay.Text & "5"

End Sub

Private Sub cmd6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd6.Click

Txtdisplay.Text = Txtdisplay.Text & "6"

End Sub

Private Sub cmd7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd7.Click

Txtdisplay.Text = Txtdisplay.Text & "7"

End Sub

Private Sub cmd8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd8.Click

Txtdisplay.Text = Txtdisplay.Text & "8"

End Sub

Private Sub cmd9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd9.Click

Txtdisplay.Text = Txtdisplay.Text & "9"

End Sub

Private Sub cmd0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd0.Click

Txtdisplay.Text = Txtdisplay.Text & "0"

End Sub

Private Sub cmddecimal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddecimal.Click

Txtdisplay.Text = Txtdisplay.Text & "."

End Sub

Private Sub cmdclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click

Txtdisplay.Text = "0"

End Sub

Private Sub cmdadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.Click

firstnumber = Val(Txtdisplay.Text)

Txtdisplay.Text = "0"

arithmeticprocess = "+"

End Sub

Private Sub cmdmultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdmultiply.Click

firstnumber = Val(Txtdisplay.Text)

Txtdisplay.Text = "0"

arithmeticprocess = "X"

End Sub

Private Sub cmdsubstract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsubstract.Click

firstnumber = Val(Txtdisplay.Text)

Txtdisplay.Text = "0"

arithmeticprocess = "-"

End Sub

Private Sub cmddivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddivide.Click

firstnumber = Val(Txtdisplay.Text)

Txtdisplay.Text = "0"

arithmeticprocess = "/"

End Sub

Private Sub cmdequal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdequal.Click

secondnumber = Val(Txtdisplay.Text)

If arithmeticprocess = "+" Then

answernumber = firstnumber + secondnumber

Source: www.dreamincode.net

Category: Taxes

Similar articles: