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
Below you will understand what is important, the idea provides one of the links with an exciting site: ounces in a pound
ReplyDelete