Thursday, December 13, 2012


here is my simple calculator for beginners. the codes that I used in this program is so simple so beginners can easily understand how it works.

the btnAdd is for addition.
the btnSub is for subtraction.
the btnMul is for multiplication.
the btnDiv is for division.

for addition i used. cDbl is for converting the textbox file into double so it can accept numbers with decimal point.


Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        txtResult.Text = CDbl(txtFirstNum.Text) + CDbl(txtSecondNum.Text)
  End Sub

for subtraction.


Private Sub btnSub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSub.Click
        txtResult.Text = CDbl(txtFirstNum.Text) - CDbl(txtSecondNum.Text)
    End Sub


for multiplication.


Private Sub btnMul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMul.Click
        txtResult.Text = CDbl(txtFirstNum.Text) * CDbl(txtSecondNum.Text)
    End Sub


for subtraction


Private Sub btnDiv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDiv.Click
        txtResult.Text = CDbl(txtFirstNum.Text) / CDbl(txtSecondNum.Text)
    End Sub





Categories:

1 comment:

  1. Below you will understand what is important, the idea provides one of the links with an exciting site: ounces in a pound

    ReplyDelete

Subscribe to RSS Feed Follow me on Twitter!