Public Class Form2 Dim satu, tiga As Double Dim dua As String Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Close() End Sub Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 0 End Sub Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 1 End Sub Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 2 End Sub Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 3 End Sub Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 4 End Sub Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 5 End Sub Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 6 End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 7 End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 8 End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click If TextBox1.Text = "∅" Then TextBox1.Clear() End If TextBox1.Text = TextBox1.Text & 9 End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click TextBox1.Clear() TextBox2.Clear() TextBox1.Text = TextBox1.Text & "∅" End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click TextBox1.Clear() TextBox2.Clear() TextBox1.Text = TextBox1.Text & "∅" End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click TextBox1.Text = Len(TextBox1.Text) - 1 If TextBox1.Text = 0 Then TextBox1.Clear() TextBox1.Text = "∅" End If End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click TextBox1.Text = TextBox1.Text & "-" End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click TextBox2.Text = TextBox2.Text & TextBox1.Text TextBox2.Text = TextBox2.Text & " / " satu = Val(TextBox1.Text) dua = "/" TextBox1.Clear() End Sub Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click TextBox2.Text = TextBox2.Text & TextBox1.Text TextBox2.Text = TextBox2.Text & " * " satu = Val(TextBox1.Text) dua = "*" TextBox1.Clear() End Sub Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click TextBox2.Text = TextBox2.Text & TextBox1.Text TextBox2.Text = TextBox2.Text & " - " satu = Val(TextBox1.Text) dua = "-" TextBox1.Clear() End Sub Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button28.Click TextBox2.Text = TextBox2.Text & TextBox1.Text TextBox2.Text = TextBox2.Text & " + " satu = Val(TextBox1.Text) dua = "+" TextBox1.Clear() End Sub Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click TextBox1.Text = TextBox1.Text & "." End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click tiga = Val(TextBox1.Text) TextBox2.Text = TextBox2.Text & TextBox1.Text If dua = "*" Then TextBox1.Clear() TextBox2.Clear() TextBox1.Text = satu * tiga ElseIf dua = "/" Then TextBox1.Clear() TextBox2.Clear() TextBox1.Text = satu / tiga ElseIf dua = "+" Then TextBox1.Clear() TextBox2.Clear() TextBox1.Text = satu + tiga ElseIf dua = "-" Then TextBox1.Clear() TextBox2.Clear() TextBox1.Text = satu - tiga End If End Sub End Class
Hasil
Mudah-mudahan bermanfaat.