VB Calculator
VB Calculator
The goal was fixed, the moves were calculated, and I moved full
of enthusiasm, figurant keen interested there were time, when it
proved to be on uphill task, the goal seeming beyond my reach. But
as the work progressed my determination and will power grow
stronger and the completion of this work further confirmed my belief
that, "Where there is a will there is a way".
You can also install VB6 on Windows 10 but you need to follow
certain steps otherwise the installation will fail. First, you need to run
setup as administrator. Next, you need to use custom installation.
Clear the checkbox for Data Access. If you don't, set up will hang at
the end of the installation. Finally, click next and wait for the
installation to complete. For complete instructions, please follow this
link Install VB6 on Windows 10
After installing the vb6 compiler, the icon will appear on your
desktop or in your programs menu. Click on the icon to launch the
VB6 compiler. On start up, Visual Basic 6.0 will display the following
dialog box as shown in Figure 1.1.
When you start a new Visual Basic 6 Standard EXE project, you will
be presented with the Visual Basic 6 Integrated Development
Environment (IDE). The Visual Basic 6 Integrated Programming
Environment is shown in Figure 1.2. It consists of the toolbox, the
form, the project explorer and the properties window.
First of all, launch Microsoft Visual Basic 6 compiler that you have
installed earlier. In the New Project Dialog , choose Standard EXE to
enter Visual Basic 6 integrated development environment. In the VB6
IDE, a default form with the name Form1 will appear. Next, double
click on Form1 to bring up the source code window for Form1, as
shown in Figure 2.1.
The top of the source code window consists of a list of objects and
their associated events or procedures. In the source code window,
the object displayed is Form1 and the associated procedure is Load.
DESIGN TIME SCREEN
In this we change the property of Text Box and we enter the name of
Text Box is ‘boxresult’ and caption is removed, Also we changed the
position and text style.
(Fig:- Properties of all numbers)
(Fig: - Properties of Arthematical Properties)
(Fig:- Properties Of Eqaul and Cancel Button)
Coding
For 1: -
Private Sub btn1_Click()
boxresult.Text = boxresult.Text + "1"
End Sub
For 2: -
Private Sub btn2_Click()
boxresult.Text = boxresult.Text + "2"
End Sub
For 3: -
Private Sub btn3_Click()
boxresult.Text = boxresult.Text + "3"
End Sub
For 4: -
Private Sub btn4_Click()
boxresult.Text = boxresult.Text + "4"
End Sub
For 5: -
Private Sub btn5_Click()
boxresult.Text = boxresult.Text + "5"
End Sub
For 6: -
Private Sub btn6_Click()
boxresult.Text = boxresult.Text + "6"
End Sub
For 7: -
Private Sub btn7_Click()
boxresult.Text = boxresult.Text + "7"
End Sub
For 8: -
Private Sub btn8_Click()
boxresult.Text = boxresult.Text + "8"
End Sub
For 9: -
Private Sub btn9_Click()
boxresult.Text = boxresult.Text + "9"
End Sub
For 0: -
Private Sub btn0_Click()
boxresult.Text = boxresult.Text + "0"
End Sub
For . : -
Private Sub btndecimal_Click()
boxresult.Text = boxresult.Text + "."
End Sub
For Sum: -
Private Sub btnsum_Click()
operator = "+"
n1 = Val(boxresult.Text)
boxresult.Text = ""
End Sub
For Subtraction: -
Private Sub btnsub_Click()
operator = "-"
n1 = Val(boxresult.Text)
boxresult.Text = ""
End Sub
For Multiplication: -
Private Sub btnsub_Click()
operator = "-"
n1 = Val(boxresult.Text)
boxresult.Text = ""
End Sub
For Division: -
Private Sub btndiv_Click()
operator = "/"
n1 = Val(boxresult.Text)
boxresult.Text = ""
End Sub
For Equal: -
Private Sub btnequal_Click()
n2 = Val(boxresult.Text)
Select Case operator
Case "+"
result = n1 + n2
Case "-"
result = n1 - n2
Case "*"
result = n1 * n2
Case "/"
result = n1 / n2
End Select
boxresult.Text = result
End Sub
For Clear: -
Private Sub btnclear_Click()
boxresult.Text = ""
End Sub
End Sub
Bibliography
The following books have been referred during the preparation
of this project: -
1. Various websites like Wikipedia, YouTube,
2. Visual Basic Programming: Black Book for Visual Basic
Programming, by John Steven Horzler
3. Previous work experiences on VB6.0