-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.vb
109 lines (90 loc) · 3.14 KB
/
Form1.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
Public Class Form1
Dim sign As String
Dim value1, value2 As Double
Private Sub zero_Click(sender As Object, e As EventArgs) Handles zero.Click
ans.Text = ans.Text & 0
End Sub
Private Sub one_Click(sender As Object, e As EventArgs) Handles one.Click
ans.Text = ans.Text & 1
End Sub
Private Sub two_Click(sender As Object, e As EventArgs) Handles two.Click
ans.Text = ans.Text & 2
End Sub
Private Sub three_Click(sender As Object, e As EventArgs) Handles three.Click
ans.Text = ans.Text & 3
End Sub
Private Sub four_Click(sender As Object, e As EventArgs) Handles four.Click
ans.Text = ans.Text & 4
End Sub
Private Sub five_Click(sender As Object, e As EventArgs) Handles five.Click
ans.Text = ans.Text & 5
End Sub
Private Sub six_Click(sender As Object, e As EventArgs) Handles six.Click
ans.Text = ans.Text & 6
End Sub
Private Sub seven_Click(sender As Object, e As EventArgs) Handles seven.Click
ans.Text = ans.Text & 7
End Sub
Private Sub eight_Click(sender As Object, e As EventArgs) Handles eight.Click
ans.Text = ans.Text & 8
End Sub
Private Sub nine_Click(sender As Object, e As EventArgs) Handles nine.Click
ans.Text = ans.Text & 9
End Sub
Private Sub plus_Click(sender As Object, e As EventArgs) Handles plus.Click
value1 = ans.Text
ans.Clear()
ans.Focus()
sign = "+"
End Sub
Private Sub minus_Click(sender As Object, e As EventArgs) Handles minus.Click
value1 = ans.Text
ans.Clear()
ans.Focus()
sign = "-"
End Sub
Private Sub multiply_Click(sender As Object, e As EventArgs) Handles multiply.Click
value1 = ans.Text
ans.Clear()
ans.Focus()
sign = "x"
End Sub
Private Sub division_Click(sender As Object, e As EventArgs) Handles division.Click
value1 = ans.Text
ans.Clear()
ans.Focus()
sign = "/"
End Sub
Private Sub reminder_Click(sender As Object, e As EventArgs) Handles reminder.Click
value1 = ans.Text
ans.Clear()
ans.Focus()
sign = "%"
End Sub
Private Sub equals_Click(sender As Object, e As EventArgs) Handles equals.Click
value2 = ans.Text
If sign = "+" Then
ans.Text = value1 + value2
ElseIf sign = "-" Then
ans.Text = value1 - value2
ElseIf sign = "x" Then
ans.Text = value1 * value2
ElseIf sign = "/" Then
ans.Text = value1 / value2
ElseIf sign = "%" Then
ans.Text = value1 Mod value2
End If
End Sub
Private Sub point_Click(sender As Object, e As EventArgs) Handles point.Click
ans.Text = ans.Text & "."
End Sub
Private Sub back_Click(sender As Object, e As EventArgs) Handles back.Click
If ans.Text.Length > 0 Then
ans.Text = ans.Text.Remove(ans.Text.Length - 1, 1)
End If
End Sub
Private Sub clear_Click(sender As Object, e As EventArgs) Handles clear.Click
ans.Clear()
ans.Focus()
End Sub
End Class