Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Calculater
- Dim a, b, c As Integer
- Dim sign As String
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Textbox1.Text = 1 & Textbox1.Text
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Textbox1.Text = Textbox1.Text & 2
- End Sub
- Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
- Textbox1.Text = Textbox1.Text & 3
- End Sub
- Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
- Textbox1.Text = Textbox1.Text & 4
- End Sub
- Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
- Textbox1.Text = Textbox1.Text & 5
- End Sub
- Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
- Textbox1.Text = Textbox1.Text & 6
- End Sub
- Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
- Textbox1.Text = Textbox1.Text & 7
- End Sub
- Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
- Textbox1.Text = Textbox1.Text & 8
- End Sub
- Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
- Textbox1.Text = Textbox1.Text & 9
- End Sub
- Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
- Textbox1.Text = Textbox1.Text & 0
- End Sub
- Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
- Textbox1.Clear()
- TextBox2.Clear()
- Textbox1.Focus()
- End Sub
- Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
- TextBox2.Text = Textbox1.Text + "+"
- a = Textbox1.Text
- Textbox1.Clear()
- Textbox1.Focus()
- sign = "+"
- End Sub
- Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
- TextBox2.Text = Textbox1.Text + "-"
- a = Textbox1.Text
- Textbox1.Clear()
- Textbox1.Focus()
- sign = "-"
- End Sub
- Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
- TextBox2.Text = Textbox1.Text + "*"
- a = Textbox1.Text
- Textbox1.Clear()
- Textbox1.Focus()
- sign = "*"
- End Sub
- Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
- TextBox2.Text = Textbox1.Text + "/"
- a = Textbox1.Text
- Textbox1.Clear()
- Textbox1.Focus()
- sign = "/"
- End Sub
- Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
- b = Textbox1.Text
- If sign = "+" Then
- Textbox1.Text = a + b
- TextBox2.Clear()
- TextBox2.Text = a.ToString + "+" + b.ToString
- ElseIf sign = "-" Then
- Textbox1.Text = a - b
- TextBox2.Clear()
- TextBox2.Text = a.ToString + "-" + b.ToString
- ElseIf sign = "*" Then
- Textbox1.Text = a * b
- TextBox2.Clear()
- TextBox2.Text = a.ToString + "*" + b.ToString
- ElseIf sign = "/" Then
- Textbox1.Text = a / b
- TextBox2.Clear()
- TextBox2.Text = a.ToString + "/" + b.ToString
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement