Visual Basic 10 Scientific Calculator Code | Genuine |
Private Sub btnCos_Click(sender As Object, e As EventArgs) Handles btnCos.Click Try Dim angle As Double = Convert.ToDouble(txtDisplay.Text) Dim result As Double = Math.Cos(angle * Math.PI / 180) txtDisplay.Text = result.ToString() Catch ex As Exception txtDisplay.Text = "Error" End Try End Sub
Private Sub btn1_Click(sender As Object, e As EventArgs) Handles btn1.Click txtDisplay.Text &= "1" End Sub
Imports System
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 Visual Basic 10 Scientific Calculator Code
The scientific calculator will have a user-friendly interface with buttons for digits 0-9, four arithmetic operations (+, -, *, /), and various scientific functions (sin, cos, tan, exp, log, etc.). The calculator will display the results in a text box.
Private Sub btn4_Click(sender As Object, e As EventArgs) Handles btn4.Click txtDisplay.Text &= "4" End Sub
Below is the complete code for the scientific calculator: Private Sub btnCos_Click(sender As Object, e As EventArgs)
Private Sub btnDivide_Click(sender As Object, e As EventArgs) Handles btnDivide.Click txtDisplay.Text &= "/" End Sub
Private Sub btnSubtract_Click(sender As Object, e As EventArgs) Handles btnSubtract.Click txtDisplay.Text &= "-" End Sub
The code above creates a scientific calculator with buttons for digits 0-9, four arithmetic operations, and various scientific functions. When a button is clicked, the corresponding digit or operator is appended to the text box. When a button is clicked, the corresponding digit
Private Sub btn8_Click(sender As Object, e As EventArgs) Handles btn8.Click txtDisplay.Text &= "8" 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
Private Sub btn6_Click(sender As Object, e As EventArgs) Handles btn6.Click txtDisplay.Text &= "6" End Sub