Coding Kalkulator Visual Basic
Dim n1, n2, h As Single
Private Sub cmdbagi_Click()
n1 = Val(tnil1.Text)
n2 = Val(tnil2.Text)
h = n1 / n2
thasil.Text = n1 / n2
End Sub
Private Sub cmdbersih_Click()
tnil1.Text = ""
tnil2.Text = ""
thasil.Text = ""
End Sub
Private Sub cmdkali_Click()
n1 = Val(tnil1.Text)
n2 = Val(tnil2.Text)
h = n1 * n2
thasil.Text = n1 * n2
End Sub
Private Sub cmdkeluar_Click()
MsgBox "Belajar VB | Sampai Jumpa Lagi"
End
End Sub
Private Sub cmdkurang_Click()
n1 = Val(tnil1.Text)
n2 = Val(tnil2.Text)
h = n1 - n2
thasil.Text = n1 - n2
End Sub
Private Sub cmdpangkat_Click()
n1 = Val(tnil1.Text)
n2 = Val(tnil2.Text)
h = n1 ^ n2
thasil.Text = n1 ^ n2
End Sub
Private Sub cmdtambah_Click()
n1 = Val(tnil1.Text)
n2 = Val(tnil2.Text)
h = n1 + n2
thasil.Text = n1 + n2
End Sub