0% found this document useful (0 votes)
16 views

Private Sub

The document describes how to create a basic calculator application in Visual Basic. It involves selecting items from the toolbox to create a textbox and buttons for numbers and operators. Code is then added to each button by double clicking it. The code assigns operations or values to the textbox based on which button is clicked. Buttons are coded for addition, subtraction, multiplication, division, and other math functions like square and factorial. A clear button is also coded to empty the textbox.

Uploaded by

Jayashree Romi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Private Sub

The document describes how to create a basic calculator application in Visual Basic. It involves selecting items from the toolbox to create a textbox and buttons for numbers and operators. Code is then added to each button by double clicking it. The code assigns operations or values to the textbox based on which button is clicked. Buttons are coded for addition, subtraction, multiplication, division, and other math functions like square and factorial. A clear button is also coded to empty the textbox.

Uploaded by

Jayashree Romi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

 First we select the Standard exe item in the view

project dialog box,


opening Visual
Basic itself.
 Then we select the Textbox from the Toolbox and make
a textbox on the form.
 Then we select the command button from the tool box
from the tool box we make buttons 0, 1, 2, 3, 4 … 9, +,
=,-,*, /, clear.
 After these all buttons are made. Then we need the
buttons to be coded. Thus double click on the button
numbered “1”, following coding is done

Private sub Command 12-Click ()


a= Text 1. Text
Text1.Text = ”+”
d=1
End Sub
 Double clicking on the Button “-”
Private sub Command 13-Click ()
a= Text 1. Text
Text1.Text =”-”
d=3
End Sub
 Double clicking on the Button “*”
Private sub Command 14-Click ()
a= Text 1. Text
Text1.Text =”*”

d=3
End Sub
 Double clicking on the Button “/”
Private sub Command 15-Click ()
a= Text 1. Text
Text1.Text =”/”
d=4
End Sub
 Double clicking on the Button “Square”
Private sub Command 16-Click ()
a= Text 1. Text
Text1.Text =”*”
C=a*a
Text1.Text = c
End Sub

 Double clicking on the Button “Factorial”


Private sub Command 17-Click ()
a= Text 1. Text
Text1.Text =”i”
e=1
for i = s to step-1
e = e*i
Text1.Text = e
End Sub
 Double clicking on the Button “Clear”
Private sub Command 18-Click ()
Text1.Text ( )
End Sub
 Double clicking on the Button “=”
Private sub Command 19-Click ()

b = Text1.Text
Select case d%
Case 1: c= a + b
Text1.Text = c
Case 2: c = a - b
Text1.Text=c
Case 3: c= a * b
Text1.Text = c
Case 4: c= a / b
Text1.Text = c
End Select
End Sub

You might also like