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

Simple and Tryable Visual Basic Calculator Code

Uploaded by

airanz.sembrano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Simple and Tryable Visual Basic Calculator Code

Uploaded by

airanz.sembrano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1 Public Class Form1

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


3 TextBox1.Text = TextBox1.Text + "1"
4 End Sub
5
6 Private Sub Button19_Click(sender As Object, e As EventArgs) Handles
Button19.Click
7 If Label2.Text = "+" Then
8 TextBox1.Text = Val(Label1.Text) + Val(TextBox1.Text)
9 Label1.Text = ""
10 Label2.Text = "="
11 End If
12
13 If Label2.Text = "-" Then
14 TextBox1.Text = Val(Label1.Text) - Val(TextBox1.Text)
15 Label1.Text = ""
16 Label2.Text = "="
17 End If
18
19 If Label2.Text = "x" Then
20 TextBox1.Text = Val(Label1.Text) * Val(TextBox1.Text)
21 Label1.Text = ""
22 Label2.Text = "="
23 End If
24
25 If Label2.Text = "/" Then
26 TextBox1.Text = Val(Label1.Text) / Val(TextBox1.Text)
27 Label1.Text = ""
28 Label2.Text = "="
29 End If
30
31 End Sub
32
33 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
34 TextBox1.Text = TextBox1.Text + "2"
35 End Sub
36
37 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
38 TextBox1.Text = TextBox1.Text + "3"
39 End Sub
40
41 Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
42 TextBox1.Text = TextBox1.Text + "4"
43 End Sub
44
45 Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
46 TextBox1.Text = TextBox1.Text + "5"
47 End Sub
48
49 Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
50 TextBox1.Text = TextBox1.Text + "6"
51 End Sub
52
53 Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
54 TextBox1.Text = TextBox1.Text + "7"
55 End Sub
56
57 Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
58 TextBox1.Text = TextBox1.Text + "8"
59 End Sub
60
61 Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
62 TextBox1.Text = TextBox1.Text + "9"
63 End Sub
64
65 Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
66 TextBox1.Text = TextBox1.Text + "0"
67 End Sub
68
69 Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
70 TextBox1.Text = TextBox1.Text + "00"
71 End Sub
72
73 Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
74 TextBox1.Text = TextBox1.Text + "."
75 End Sub
76
77 Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
78 Label1.Text = TextBox1.Text
79 Label2.Text = "+"
80 TextBox1.Text = ""
81 End Sub
82
83 Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
84 Label1.Text = TextBox1.Text
85 Label2.Text = "-"
86 TextBox1.Text = ""
87 End Sub
88
89 Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
90 Label1.Text = TextBox1.Text
91 Label2.Text = "x"
92 TextBox1.Text = ""
93 End Sub
94
95 Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
96 Label1.Text = TextBox1.Text
97 Label2.Text = "/"
98 TextBox1.Text = ""
99 End Sub
100
101 Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
102 TextBox1.Text = ""
103 Label2.Text = ""
104 End Sub
105
106 Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
107 TextBox1.Text = ""
108 Label2.Text = ""
109 Label1.Text = ""
110 End Sub
111 End Class
112

You might also like