Private Sub btnDivide_Click(sender As Object, e As EventArgs) Handles btnDivide.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. Visual Basic 10 Scientific Calculator Code
Private Sub btnSin_Click(sender As Object, e As EventArgs) Handles btnSin.Click Try Dim angle As Double = Convert.ToDouble(txtDisplay.Text) Dim result As Double = Math.Sin(angle * Math.PI / 180) txtDisplay.Text = result.ToString() Catch ex As Exception txtDisplay.Text = "Error" End Try End Sub Private Sub btnDivide_Click(sender As Object
Private Sub btn6_Click(sender As Object, e As EventArgs) Handles btn6.Click txtDisplay.Text &= "6" End Sub four arithmetic operations
Imports System
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click txtDisplay.Text &= "+" End Sub