Searching...
Private Sub btnExp_Click(sender As Object, e As EventArgs) Handles btnExp.Click Try Dim result As Double = Math.Exp(Convert.ToDouble(txtDisplay.Text)) txtDisplay.Text = result.ToString() Catch ex As Exception txtDisplay.Text = "Error" End Try End Sub
Private Sub btnTan_Click(sender As Object, e As EventArgs) Handles btnTan.Click Try Dim angle As Double = Convert.ToDouble(txtDisplay.Text) Dim result As Double = Math.Tan(angle * Math.PI / 180) txtDisplay.Text = result.ToString() Catch ex As Exception txtDisplay.Text = "Error" End Try End Sub Visual Basic 10 Scientific Calculator Code
Private Sub btnDivide_Click(sender As Object, e As EventArgs) Handles btnDivide.Click txtDisplay.Text &= "/" End Sub Private Sub btnExp_Click(sender As Object, e As EventArgs)
Private Sub btnMultiply_Click(sender As Object, e As EventArgs) Handles btnMultiply.Click txtDisplay.Text &= "*" End Sub Private Sub btnExp_Click(sender As Object
Private Sub btn1_Click(sender As Object, e As EventArgs) Handles btn1.Click txtDisplay.Text &= "1" End Sub
The scientific function buttons ( btnSin , btnCos , btnTan , btnExp , btnLog ) evaluate the corresponding mathematical function using the Math class.