0% found this document useful (0 votes)
85 views9 pages

Visual Basic Simple Calculator Code

The document describes a calculator application coded in Visual Basic. It includes code for number buttons, arithmetic operators, and trigonometric functions. The code handles input validation and displays results. The application was submitted by a student to their structural engineering lab instructor for a class project.

Uploaded by

Afzal Waseem
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 DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views9 pages

Visual Basic Simple Calculator Code

The document describes a calculator application coded in Visual Basic. It includes code for number buttons, arithmetic operators, and trigonometric functions. The code handles input validation and displays results. The application was submitted by a student to their structural engineering lab instructor for a class project.

Uploaded by

Afzal Waseem
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 DOC, PDF, TXT or read online on Scribd

University of Engineering and Technology Lahore Civil Engineering Department

CODDING OF CALCULATOR IN VISUAL BASIC


STRUCTUAL ENGINEERING LAB

Submited To: Dr Aun Bashir

Submited By: Afzal Waseem 2007-Civil-87


Section B

University of Engineering and Technology Lahore Civil Engineering Department

University of Engineering and Technology Lahore Civil Engineering Department

Private Sub Command1_Click() [Link] = [Link] + "1" End Sub Private Sub Command10_Click() [Link] = [Link] + "0" End Sub Private Sub Command11_Click() If Not IsNumeric([Link]) Then MsgBox "Please enter numbers.", vbInformation 'you may also consider erasing it [Link] = "" End If a = Val([Link]) [Link] = "" End Sub Private Sub Command12_Click() If Not IsNumeric([Link]) Then MsgBox "Please enter numbers.", vbInformation 'you may also consider erasing it [Link] = "" End If a = Val([Link]) [Link] = "" End Sub Private Sub Command13_Click() If Not IsNumeric([Link]) Then MsgBox "Please enter numbers.", vbInformation 'you may also consider erasing it [Link] = "" End If a = Val([Link]) [Link] = "" End Sub Private Sub Command14_Click() If Not IsNumeric([Link]) Then MsgBox "Please enter numbers.", vbInformation 'you may also consider erasing it [Link] = "" End If a = Val([Link])

University of Engineering and Technology Lahore Civil Engineering Department [Link] = "" End Sub Private Sub Command15_Click() If [Link] = True Then b = Val([Link]) c=a+b [Link] = c Else If [Link] = True Then b = Val([Link]) c=a-b [Link] = c Else If [Link] = True Then b = Val([Link]) c=a*b [Link] = c Else If [Link] = True Then b = Val([Link]) c=a/b [Link] = c End If End If End If End If End Sub Private Sub Command16_Click() [Link] = "" End Sub Private Sub Command2_Click() [Link] = [Link] + "2" End Sub Private Sub Command3_Click() [Link] = [Link] + "3" End Sub Private Sub Command4_Click() [Link] = [Link] + "4" End Sub Private Sub Command5_Click()

University of Engineering and Technology Lahore Civil Engineering Department [Link] = [Link] + "5" End Sub Private Sub Command6_Click() [Link] = [Link] + "6" End Sub Private Sub Command7_Click() [Link] = [Link] + "7" End Sub Private Sub Command8_Click() [Link] = [Link] + "8" End Sub Private Sub Command9_Click() [Link] = [Link] + "9" End Sub Private Sub Form_Load() Dim a As Single Dim b As Single Dim c As Single End Sub

University of Engineering and Technology Lahore Civil Engineering Department

University of Engineering and Technology Lahore Civil Engineering Department Private Sub Command1_Click() a = Val([Link]) b = Val([Link]) c=a+b [Link] = c If Not IsNumeric([Link]) Then MsgBox "Please enter number in x.", vbInformation 'you may also consider erasing it [Link] = "" End If If Not IsNumeric([Link]) Then MsgBox "Please enter number in y.", vbInformation 'you may also consider erasing it [Link] = "" End If End Sub Private Sub Command2_Click() a = Val([Link]) b = Val([Link]) c=a-b [Link] = c If Not IsNumeric([Link]) Then MsgBox "Please enter number in x", vbInformation 'you may also consider erasing it [Link] = "" End If If Not IsNumeric([Link]) Then MsgBox "Please enter number in y", vbInformation 'you may also consider erasing it [Link] = "" End If End Sub Private Sub Command3_Click() a = Val([Link]) b = Val([Link]) c=a*b [Link] = c If Not IsNumeric([Link]) Then MsgBox "Please enter number in x", vbInformation

University of Engineering and Technology Lahore Civil Engineering Department 'you may also consider erasing it [Link] = "" End If If Not IsNumeric([Link]) Then MsgBox "Please enter numbers only.", vbInformation 'you may also consider erasing it [Link] = "" End If End Sub Private Sub Command4_Click() If Not IsNumeric([Link]) Then MsgBox "Please enter numbers only.", vbInformation 'you may also consider erasing it [Link] = "" End If If Not IsNumeric([Link]) Then MsgBox "Please enter numbers only.", vbInformation 'you may also consider erasing it [Link] = "" GoTo 10 End If a = Val([Link]) b = Val([Link]) c=a/b [Link] = c 10 ' End Sub Private Sub Command5_Click() a = Val([Link]) b = Val([Link]) c = Val([Link]) If Not IsNumeric([Link]) Then MsgBox "Please enter the number in X to find power of.", vbInformation 'you may also consider erasing it [Link] = "" GoTo 10 End If d = a ^ (b / c) [Link] = d

University of Engineering and Technology Lahore Civil Engineering Department 10 ' End Sub Private Sub Command6_Click() [Link] = "" [Link] = "" [Link] = "" End Sub Private Sub Command7_Click() a = Val([Link]) b = Val([Link]) b = Cos(a) [Link] = b End Sub

You might also like