Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Calculator Source Codes in VB.Net, Lab Reports of Object Oriented Programming

This consists of a program about simple calculator. It has source codes and screenshots of its output.

Typology: Lab Reports

2020/2021

Available from 04/02/2022

mary-vibal
mary-vibal 🇵🇭

5 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PF101 – Object Oriented Programming
Laboratory Activity #3 – Self-Designed Calculator
Vibal, Mary Joy C. Prof. Ronnie Gatdula
2nd Year – SFIT2C
Source Code:
Public Class Form1
Dim num1 As Double
Dim num2 As Double
Dim operations As Integer
Dim operator_selector As Boolean = False
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
num1 = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 5
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "1"
Else
TextBox1.Text = "1"
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
num1 = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 7
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles
Button4.Click
num1 = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 6
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles
Button5.Click
num1 = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 1
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles
Button6.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "3"
pf3
pf4
pf5

Partial preview of the text

Download Calculator Source Codes in VB.Net and more Lab Reports Object Oriented Programming in PDF only on Docsity!

PF101 – Object Oriented Programming

Laboratory Activity #3 – Self-Designed Calculator

Vibal, Mary Joy C. Prof. Ronnie Gatdula

2 nd^ Year – SFIT2C

Source Code:

Public Class Form Dim num1 As Double Dim num2 As Double Dim operations As Integer Dim operator_selector As Boolean = False Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click num1 = TextBox1.Text TextBox1.Text = "0" operator_selector = True operations = 5 End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If TextBox1.Text <> "0" Then TextBox1.Text += "1" Else TextBox1.Text = "1" End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click num1 = TextBox1.Text TextBox1.Text = "0" operator_selector = True operations = 7 End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click num1 = TextBox1.Text TextBox1.Text = "0" operator_selector = True operations = 6 End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click num1 = TextBox1.Text TextBox1.Text = "0" operator_selector = True operations = 1 End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click If TextBox1.Text <> "0" Then TextBox1.Text += "3"

Else TextBox1.Text = "3" End If End Sub Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click If TextBox1.Text <> "0" Then TextBox1.Text += "5" Else TextBox1.Text = "5" End If End Sub Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click num1 = TextBox1.Text TextBox1.Text = "0" operator_selector = True operations = 2 End Sub Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click If TextBox1.Text <> "0" Then TextBox1.Text += "6" Else TextBox1.Text = "6" End If End Sub Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click num1 = TextBox1.Text TextBox1.Text = "0" operator_selector = True operations = 3 End Sub Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click If TextBox1.Text <> "0" Then TextBox1.Text += "7" Else TextBox1.Text = "7" End If End Sub Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click If TextBox1.Text <> "0" Then TextBox1.Text += "2" Else TextBox1.Text = "2" End If End Sub Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click If TextBox1.Text <> "0" Then TextBox1.Text += "4" Else TextBox1.Text = "4" End If End Sub

Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click If TextBox1.Text <> "0" Then TextBox1.Text += "0" End If End Sub Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click TextBox1.Text = "" End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub End Class

Output:

Example input: 4568 x 9