This document provides a Visual Basic 6 (VB6) code for a simple calculator application. It includes functionality for basic arithmetic operations such as addition, subtraction, multiplication, and division, along with a user interface for inputting numbers. The code handles button clicks to input numbers and perform calculations based on the selected operator.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
44 views3 pages
Design Simple Calculator Using VB6
This document provides a Visual Basic 6 (VB6) code for a simple calculator application. It includes functionality for basic arithmetic operations such as addition, subtraction, multiplication, and division, along with a user interface for inputting numbers. The code handles button clicks to input numbers and perform calculations based on the selected operator.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
//Design Simple Calculator Using VB6
Option Explicit Dim a As Double Dim b As Double Dim operator As String
Private Sub Command1_Click()
Text1.Text = Text1.Text + "1" End Sub
Private Sub Command10_Click()
Text1.Text = Text1.Text + "0" End Sub
Private Sub Command11_Click()
a = Val(Text1.Text) operator = "+" Text1.Text = "" End Sub
Private Sub Command12_Click()
a = Val(Text1.Text) operator = "-" Text1.Text = "" End Sub
Private Sub Command13_Click()
a = Val(Text1.Text) operator = "/" Text1.Text = "" End Sub
Private Sub Command14_Click()
a = Val(Text1.Text) operator = "*" Text1.Text = "" End Sub
Private Sub Command15_Click()
Text1.Text = "" End Sub
Private Sub Command16_Click()
Dim result As Double b = Val(Text1.Text) If operator = "+" Then result = a + b If operator = "-" Then result = a - b If operator = "*" Then result = a * b If operator = "/" Then result = a / b Text1.Text = result End Sub
Aim_Write a program in VB that constructs a scientific calculator with Sine, Cosine, Tangent, Logarithm, 1_x (Reciprocal), and sqr (Square root) functions