Simple Calculator3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 41

ACTIVITY #1

FORM 1 - SIMPLE CALCULATOR

Public Class Form1


Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""

TextBox2.Text = " "


TextBox3.Text = " "
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


MsgBox("Thank You :) ! ")
End
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click


TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
End Sub

Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click


TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)

End Sub
End Class

ACTIVITY #2

FORM 1 - LOGIN FORM

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If TextBox1.Text = "JEC" And TextBox2.Text = "12345" Then
MsgBox( Thank You !")
Else
MsgBox("Error!")
TextBox1.Text = " "
TextBox2.Text = " "
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


End
End Sub
End Class

ACTIVITY #3
FORM 1 LOGIN FORM

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If TextBox1.Text = "Jecmar" And TextBox2.Text = "082615" Then

Form2.Show()
Me.Hide()
Else
MsgBox("Error!")
TextBox1.Text = " "
TextBox2.Text = " "
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


End
End Sub
End Class

FORM 2 - MENU

Public Class Form2

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Form3.Show()
Me.Hide()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Form4.Show()
Me.Hide()

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


End
End Sub
End Class

FORM 3 - VOTE

Public Class Form3

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If Val(TextBox1.Text) >= 18 Then
Label2.Text = "Qualified to Vote!"
Else
Label2.Text = "Not Qualified to Vote"
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Text = " "
Label2.Text = " "
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Form2.Show()
Me.Hide()

End Sub
End Class

FORM 4 - GRADE

Public Class Form4

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If Val(TextBox1.Text) <= 74 Then
Label2.Text = "FAILED!"
ElseIf Val(TextBox1.Text) = 75 Then
Label2.Text = "PASSED!"
ElseIf Val(TextBox1.Text) <= 79 Then
Label2.Text = "SATISFACTORY!"
ElseIf Val(TextBox1.Text) <= 89 Then
Label2.Text = "VERY SATISFACTORY!"
ElseIf Val(TextBox1.Text) <= 99 Then
Label2.Text = "EXCELLENT!"
ElseIf Val(TextBox1.Text) = 100 Then
Label2.Text = "PERFECT!"
Else

Label2.Text = "NOT AVAILABLE!"


End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Text = " "
Label2.Text = " "
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Form2.Show()
Me.Hide()
End Sub
End Class
ACTIVITY #4
FORM 1 - MENU

Public Class Form1

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click


Form2.Show()
Me.Hide()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Form3.Show()
Me.Hide()

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Form4.Show()
Me.Hide()

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


MsgBox("Thank you ! Have a nice day :) ")

End

End Sub
End Class

FORM 2 AVERAGE OF 3 NUMBERS

Public Class Form2


Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
TextBox4.Text =(Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text))/3
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Text = " "
TextBox2.Text = " "

TextBox3.Text = " "


TextBox4.Text = " "
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Form1.Show()
Me.Hide()

End Sub
End Class

FORM 3 CONVERTING CELCIUS TO FAHRENHEIT

Public Class Form3

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


TextBox2.Text = Val(TextBox1.Text) * (9 / 5) + 32

End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Form1.Show()
Me.Hide()

End Sub

End Class

FORM 4 CONVERTING FAHRENHEIT TO CELCIUS

Public Class Form4


Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
TextBox2.Text = (Val(TextBox1.Text) - 32) * 5 / 9
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
End Class

ACTIVITY #5
FORM 1 USER PIN

Public Class Form1

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click


If TextBox1.Text = "082615" Then
Form2.Show()
Me.Hide()
Else
MsgBox("Wrong PIN number. Please enter again!")
TextBox1.Text = " "
End If

End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End

End Sub
End Class

FORM 2 INITIAL DEPOSIT

Public Class Form2

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Form3.Show()
Me.Hide()
End Sub
End Class

FORM 3 MENU

Public Class Form3

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Form4.Show()
Me.Hide()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Form5.Show()
Me.Hide()

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Form6.Show()
Me.Hide()

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


End

End Sub
End Class

FORM 4 BALANCE INQUIRY

Public Class Form4

Private Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load


Label3.Text = Form2.TextBox1.Text

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Form3.Show()
Me.Hide()

End Sub

End Class

FORM 5 DEPOSIT

Public Class Form5

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Form4.Label3.Text = Val(Form2.TextBox1.Text) + Val(TextBox1.Text)
Form3.Show()
Me.Hide()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Form3.Show()
Me.Hide()

End Sub
End Class

FORM 6 WITHDRAWAL

Public Class Form6

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If Val(TextBox1.Text) <= Val(Form4.Label3.Text) Then
Form4.Label3.Text = Val(Form4.Label3.Text) - Val(TextBox1.Text)
Form3.Show()
Me.Hide()
Else
MsgBox("Insuficient Funds.")
TextBox1.Text = " "
End If

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Form3.Show()
Me.Hide()

End Sub
End Class

ACTIVITY #6
FORM 1 LOGIN

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If TextBox1.Text = "Jecmar" And TextBox2.Text = "082615" Then
Form2.Show()
Me.Hide()
Else
MsgBox("Invalid!")
TextBox1.Text = " "
TextBox2.Text = " "
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


End

End Sub
End Class

FORM 2 CALCULATOR

Public Class Form2


Dim fnum, snum As Integer
Dim result As Integer

Dim op As Char
Dim memoryvalue As Integer
'1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "1"
Else
TextBox1.Text = TextBox1.Text + "1"
End If
End Sub
'2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "2"
Else
TextBox1.Text = TextBox1.Text + "2"
End If
End Sub
'3
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "3"
Else
TextBox1.Text = TextBox1.Text + "3"
End If

End Sub
'4
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "4"
Else
TextBox1.Text = TextBox1.Text + "4"
End If
End Sub
'5
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "5"
Else
TextBox1.Text = TextBox1.Text + "5"
End If
End Sub
'6
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "6"
Else
TextBox1.Text = TextBox1.Text + "6"
End If
End Sub

'7
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "7"
Else
TextBox1.Text = TextBox1.Text + "7"
End If
End Sub
'8
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "8"
Else
TextBox1.Text = TextBox1.Text + "8"
End If
End Sub
'9
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
If TextBox1.Text = "0" Then
TextBox1.Text = "9"
Else
TextBox1.Text = TextBox1.Text + "9"
End If
End Sub
'0

Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click


If TextBox1.Text = "0" Then
TextBox1.Text = "0"
Else
TextBox1.Text = TextBox1.Text + "0"
End If
End Sub
'/
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
fnum = TextBox1.Text
op = sender.text
TextBox1.Text = " "
End Sub
'*
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
fnum = TextBox1.Text
op = sender.text
TextBox1.Text = " "
End Sub
'Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
fnum = TextBox1.Text
op = sender.text
TextBox1.Text = " "
End Sub

'+
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
fnum = TextBox1.Text
op = sender.text
TextBox1.Text = " "
End Sub
'=
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
snum = TextBox1.Text
If op = "+" Then
TextBox1.Text = fnum + snum
ElseIf op = "*" Then
TextBox1.Text = fnum * snum
ElseIf op = "-" Then
TextBox1.Text = fnum - snum
ElseIf op = "/" Then
TextBox1.Text = fnum / snum
End If
End Sub
'C
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
fnum = 0
snum = 0
TextBox1.Text = "0"
End Sub

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub
End Class
ACTIVITY #7

Public Class Form1

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Text = "JECMAR"
TextBox1.ForeColor = Color.Green
Else
TextBox1.Text = " "
End If
End Sub

Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
TextBox1.Text = "JECMAR"
TextBox1.ForeColor = Color.Yellow
Else
TextBox1.Text = " "
End If
End Sub

Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
TextBox1.Text = "JECMAR"
TextBox1.ForeColor = Color.Blue
Else
TextBox1.Text = " "
End If
End Sub

Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox4.CheckedChanged
If CheckBox4.Checked = True Then
TextBox1.Text = "JECMAR"
TextBox1.ForeColor = Color.Red
Else

TextBox1.Text = " "


End If
End Sub

Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox5.CheckedChanged
If CheckBox5.Checked = True Then
TextBox1.Text = "JECMAR"
TextBox1.TextAlign = HorizontalAlignment.Center
Else
TextBox1.Text = " "

End If
End Sub

Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox6.CheckedChanged
If CheckBox6.Checked = True Then
TextBox1.Text = "JECMAR"
TextBox1.TextAlign = HorizontalAlignment.Left
Else
TextBox1.Text = " "
End If
End Sub

Private Sub CheckBox7_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox7.CheckedChanged

If CheckBox7.Checked = True Then


TextBox1.Text = "JECMAR"
TextBox1.TextAlign = HorizontalAlignment.Right
Else
TextBox1.Text = " "

End If
End Sub
End Class

ACTIVITY #8

Public Class Form1

Dim sum As Integer


Dim JUICE As Integer
Dim COKE As Integer
Dim SPRITE As Integer
Dim ROYAL As Integer
Dim PEPSI As Integer
Dim MDEW As Integer
Dim SUP As Integer
Dim BURGER As Integer
Dim HOTDOG As Integer
Dim SPAG As Integer
Dim SANDW As Integer
Dim TEMP As Integer
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles
CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
JUICE = 5 * Val(TextBox1.Text)
sum += JUICE
TextBox13.Text = sum.ToString
End If

End Sub

Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox2.CheckedChanged
If CheckBox1.Checked = True Then

COKE = 15 * Val(TextBox2.Text)
sum += COKE
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
SPRITE = 15 * Val(TextBox3.Text)
sum += SPRITE
TextBox13.Text = sum.ToString
End If

End Sub

Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox4.CheckedChanged
If CheckBox4.Checked = True Then
ROYAL = 15 * Val(TextBox4.Text)
sum += ROYAL
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox5.CheckedChanged

If CheckBox5.Checked = True Then


PEPSI = 15 * Val(TextBox5.Text)
sum += PEPSI
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox6.CheckedChanged
If CheckBox6.Checked = True Then
MDEW = 15 * Val(TextBox6.Text)
sum += MDEW
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox7_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox7.CheckedChanged
If CheckBox7.Checked = True Then
SUP = 15 * Val(TextBox7.Text)
sum += SUP
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox8_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox8.CheckedChanged

If CheckBox8.Checked = True Then


BURGER = 30 * Val(TextBox8.Text)
sum += BURGER
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox9_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox9.CheckedChanged
If CheckBox9.Checked = True Then
HOTDOG = 25 * Val(TextBox9.Text)
sum += HOTDOG
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox10_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox10.CheckedChanged
If CheckBox10.Checked = True Then
SPAG = 20 * Val(TextBox10.Text)
sum += SPAG
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox11_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox11.CheckedChanged

If CheckBox11.Checked = True Then


SANDW = 15 * Val(TextBox11.Text)
sum += SANDW
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub CheckBox12_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox12.CheckedChanged
If CheckBox12.Checked = True Then
TEMP = 15 * Val(TextBox12.Text)
sum += TEMP
TextBox13.Text = sum.ToString
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If Val(TextBox14.Text) < Val(TextBox13.Text) Then
MsgBox("Insuficient")
Else
TextBox15.Text = Val(TextBox14.Text) - Val(TextBox13.Text)
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
CheckBox1.Checked = False
CheckBox2.Checked = False

CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
CheckBox8.Checked = False
CheckBox9.Checked = False
CheckBox10.Checked = False
CheckBox11.Checked = False
CheckBox12.Checked = False
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
TextBox7.Text = " "
TextBox8.Text = " "
TextBox9.Text = " "
TextBox10.Text = " "
TextBox11.Text = " "
TextBox12.Text = " "
TextBox13.Text = " "
TextBox14.Text = " "
TextBox15.Text = " "

End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
End

End Sub
End Class

You might also like