Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
- If Button22.Text = 1 Then
- Button22.Text = 2
- ElseIf Button22.Text = 2 Then
- Button22.Text = 1
- End If
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "1"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "1"
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "2"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "2"
- End If
- End Sub
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "3"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "3"
- End If
- End Sub
- Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "4"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "4"
- End If
- End Sub
- Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "5"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "5"
- End If
- End Sub
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "6"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "6"
- End If
- End Sub
- Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "7"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "7"
- End If
- End Sub
- Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "8"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "8"
- End If
- End Sub
- Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
- If Button22.Text = 1 Then
- TextBox1.Text = TextBox1.Text & "9"
- ElseIf Button22.Text = 2 Then
- TextBox2.Text = TextBox2.Text & "9"
- End If
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- If Button22.Text = 1 Then
- If TextBox1.Text <> "" Then
- TextBox1.Text = TextBox1.Text & "0"
- End If
- ElseIf Button22.Text = 2 Then
- If TextBox2.Text <> "" Then
- TextBox2.Text = TextBox2.Text & "0"
- End If
- End If
- End Sub
- Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
- If Button22.Text = 1 Then
- If TextBox1.Text = "" Then
- TextBox1.Text = TextBox1.Text & "0."
- Else
- TextBox1.Text = TextBox1.Text & "."
- End If
- ElseIf Button22.Text = 2 Then
- If TextBox2.Text = "" Then
- TextBox2.Text = TextBox2.Text & "0."
- Else
- TextBox1.Text = TextBox1.Text & "."
- End If
- End If
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- Label1.Text = "+"
- End Sub
- Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
- Label1.Text = "*"
- End Sub
- Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
- Label1.Text = "-"
- End Sub
- Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
- Label1.Text = "/"
- End Sub
- Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
- Label1.Text = "O"
- TextBox1.Text = ""
- TextBox2.Text = ""
- TextBox3.Text = ""
- End Sub
- Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
- If Button22.Text = 1 And TextBox1.Text <> "" Then
- If TextBox1.Text.Substring(0, 1) = "-" Then
- TextBox1.Text.Remove(0, 1)
- Else
- TextBox1.Text = "-" & TextBox1.Text
- End If
- ElseIf Button22.Text = 2 And TextBox2.Text <> "" Then
- If TextBox2.Text.Substring(0, 1) = "-" Then
- TextBox2.Text.Remove(0, 1)
- Else
- TextBox2.Text = "-" & TextBox2.Text
- End If
- End If
- End Sub
- Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
- If Button22.Text = 1 And TextBox1.Text <> "" Then
- Try
- Dim hasil As Double = CDbl(TextBox1.Text)
- hasil = Math.Sqrt(hasil)
- TextBox1.Text = hasil
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- ElseIf Button22.Text = 2 And TextBox2.Text <> "" Then
- Try
- Dim hasil As Double = CDbl(TextBox2.Text)
- hasil = Math.Sqrt(hasil)
- TextBox2.Text = hasil
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- End If
- End Sub
- Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
- If Button22.Text = 1 And TextBox1.Text <> "" Then
- Try
- Dim hasil As Double = CDbl(TextBox1.Text)
- hasil = hasil / 100
- TextBox1.Text = hasil
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- ElseIf Button22.Text = 2 And TextBox2.Text <> "" Then
- Try
- Dim hasil As Double = CDbl(TextBox2.Text)
- hasil = hasil / 100
- TextBox2.Text = hasil
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- End If
- End Sub
- Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
- If Button22.Text = 1 And TextBox1.Text <> "" Then
- Try
- Dim hasil As Double = CDbl(TextBox1.Text)
- hasil = 1 / hasil
- TextBox1.Text = hasil
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- ElseIf Button22.Text = 2 And TextBox2.Text <> "" Then
- Try
- Dim hasil As Double = CDbl(TextBox2.Text)
- hasil = 1 / hasil
- TextBox2.Text = hasil
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- End If
- End Sub
- Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
- Try
- Dim num1 As Double = CDbl(TextBox1.Text)
- Dim num2 As Double = CDbl(TextBox2.Text)
- If Label1.Text = "+" Then
- Dim hasil As Double = num1 + num2
- TextBox3.Text = hasil
- ElseIf Label1.Text = "*" Then
- Dim hasil As Double = num1 * num2
- TextBox3.Text = hasil
- ElseIf Label1.Text = "/" Then
- Dim hasil As Double = num1 / num2
- TextBox3.Text = hasil
- ElseIf Label1.Text = "-" Then
- Dim hasil As Double = num1 - num2
- TextBox3.Text = hasil
- Else
- MsgBox("Operator belum dipilih")
- End If
- Catch ex As Exception
- MsgBox("Operation Failed")
- End Try
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement