In this code,while executing it does's show the result.
For eg: Consider addition,in addition result it shows the second value to be added.
How it can be corrected?
Public Class calculator
Dim add, subt, mul, res As Integer
Dim div As Double
Dim ch As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zero.Click
TextBox1.Text = TextBox1.Text & zero.Text
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = TextBox1.Text & Button2.Text
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = TextBox1.Text & Button3.Text
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text = TextBox1.Text & Button4.Text
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text = TextBox1.Text & Button5.Text
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.Text = Val(Button6.Text)
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = TextBox1.Text & Button7.Text
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
TextBox1.Text = TextBox1.Text & Button8.Text
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.Text = TextBox1.Text & Button9.Text
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
TextBox1.Text = TextBox1.Text & Button10.Text
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
Dim add As Integer = 0
add = Val(TextBox1.Text)
TextBox1.Clear()
ch = "plus"
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Dim subt As Integer = 0
subt = Val(TextBox1.Text)
TextBox1.Clear()
ch = "minus"
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
Dim mul As Integer = 0
mul = Val(TextBox1.Text)
TextBox1.Clear()
ch = "prod"
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
Dim div As Double = 0
div = Val(TextBox1.Text)
TextBox1.Clear()
ch = "div"
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Select Case ch
Case "plus"
Res = add + Val(TextBox1.Text)
TextBox1.Text = Str(res)
Case "subt"
Res = subt - Val(TextBox1.Text)
TextBox1.Text = Str(Res)
Case "prod"
res = mul * Val(TextBox1.Text)
TextBox1.Text = Str(Res)
Case "div"
Res = div / Val(TextBox1.Text)
TextBox1.Text = Str(Res)
End Select
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
TextBox1.Clear()
End Sub
End Class