-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm2.vb
149 lines (109 loc) · 3.55 KB
/
Form2.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
Public Class Form2
Dim a As Decimal
Dim b As Decimal
Dim c As Integer
Dim operation As Boolean = False
'butoon_1
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
TextBox1.Text += "1"
End Sub
'butoon_2
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
TextBox1.Text += "2"
End Sub
'butoon_3
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
TextBox1.Text += "3"
End Sub
'butoon_4
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
TextBox1.Text += "4"
End Sub
'butoon_5
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
TextBox1.Text += "5"
End Sub
'butoon_6
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
TextBox1.Text += "6"
End Sub
'butoon_7
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text += "7"
End Sub
'butoon_8
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text += "8"
End Sub
'butoon_9
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox1.Text += "9"
End Sub
'butoon_0
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
TextBox1.Text += "0"
End Sub
'butoon_dot
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
Dim s As String
s = TextBox1.Text
If Not s.Contains(".") Then
TextBox1.Text += "."
End If
End Sub
'clear_button
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
TextBox1.Text = ""
End Sub
'addition_button
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
a = TextBox1.Text
TextBox1.Text = ""
c = 1
operation = True
End Sub
'subraction_button
Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
a = TextBox1.Text
TextBox1.Text = ""
c = 2
operation = True
End Sub
'multiplication_button
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
a = TextBox1.Text
TextBox1.Text = ""
c = 3
operation = True
End Sub
'division_button
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
a = TextBox1.Text
TextBox1.Text = ""
c = 4
operation = True
End Sub
'equal_button
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
If operation = True Then
b = TextBox1.Text
If c = 1 Then
TextBox1.Text = a + b
ElseIf c = 2 Then
TextBox1.Text = a - b
ElseIf c = 3 Then
TextBox1.Text = a * b
ElseIf b = 0 Then
TextBox1.Text = "Error..!!"
Else
TextBox1.Text = a / b
End If
End If
End Sub
'delete_button
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If TextBox1.Text.Length > 0 Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
End If
End Sub
End Class