Public Class Form1
Dim strmiddle() As String = {"0", "0", "0"}
Dim calmethod1 As String = "0"
Dim calmethod2 As String = "0"
Dim strdot As Boolean = False
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
If strmiddle(0) = "0" Then
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "0"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "0"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
strdot = True
strmiddle(0) = strmiddle(0) & "."
TextBox1.Text = strmiddle(0)
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
strmiddle(0) = "0"
strmiddle(1) = "0"
strmiddle(2) = "0"
calmethod1 = "0"
calmethod2 = "0"
strdot = False
TextBox1.Text = "0."
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "1"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "1"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "1"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "2"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "2"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "2"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "3"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "3"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "3"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "4"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "4"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "4"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "5"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "5"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "5"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "6"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "6"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "6"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "7"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "7"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "7"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "8"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "8"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "8"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "9"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "9"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "9"
TextBox1.Text = strmiddle(0)
End If
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
TextBox1.Text = "0"
End Sub
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
Me.Close()
End Sub
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
If calmethod1 = "0" Then
calmethod1 = "*"
strmiddle(1) = strmiddle(0)
strmiddle(0) = "0"
Else : Select Case calmethod1
Case "+"
calmethod2 = "*"
strmiddle(2) = strmiddle(0)
strmiddle(0) = "0"
Case "-"
calmethod2 = "*"
strmiddle(2) = strmiddle(0)
strmiddle(0) = "0"
Case "*"
strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "*"
Case "/"
strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "*"
End Select
End If
End Sub
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
If calmethod1 = "0" Then
calmethod1 = "/"
strmiddle(1) = strmiddle(0)
strmiddle(0) = "0"
Else : Select Case calmethod1
Case "+"
calmethod2 = "/"
strmiddle(2) = strmiddle(0)
strmiddle(0) = "0"
Case "-"
calmethod2 = "/"
strmiddle(2) = strmiddle(0)
strmiddle(0) = "0"
Case "*"
strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "/"
Case "/"
strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "/"
End Select
End If
End Sub
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
If calmethod1 = "0" Then
calmethod1 = "+"
strmiddle(1) = strmiddle(0)
strmiddle(0) = "0"
Else : Select Case calmethod1
Case "+"
strmiddle(1) = Str(Val(strmiddle(0)) + Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "+"
Case "-"
strmiddle(1) = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "+"
Case "*"
strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "+"
Case "/"
strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "+"
End Select
End If
End Sub
Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
If calmethod1 = "0" Then
calmethod1 = "-"
strmiddle(1) = strmiddle(0)
strmiddle(0) = "0"
Else : Select Case calmethod1
Case "+"
strmiddle(1) = Str(Val(strmiddle(0)) + Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "-"
Case "-"
strmiddle(1) = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "-"
Case "*"
strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "-"
Case "/"
strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "-"
End Select
End If
End Sub
Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
If strmiddle(2) = "0" Then
Select Case calmethod1
Case "+"
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
Case "-"
TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
Case "*"
TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
Case "/"
If strmiddle(0) = "0" Then
TextBox1.Text = "error!"
Else
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
End If
End Select
ElseIf calmethod2 = "*" Then
strmiddle(0) = Str(Val(strmiddle(0)) + Val(strmiddle(2)))
Select Case calmethod1
Case "+"
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
Case "-"
TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
Case "*"
TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
Case "/"
If strmiddle(0) = "0" Then
TextBox1.Text = "error!"
Else
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
End If
End Select
Else : calmethod2 = "/"
strmiddle(0) = Str(Val(strmiddle(2)) + Val(strmiddle(0)))
Select Case calmethod1
Case "+"
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
Case "-"
TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
Case "*"
TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
Case "/"
If strmiddle(0) = "0" Then
TextBox1.Text = "error!"
Else
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
End If
End Select
End If
End Sub
End Class