Langkah-langkah membuat kalkulator sederhana :
1.Design Form seperti yang di bawah ini :
2. Masukan koding program nya :
Public Class Form1
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
Nilaipertama.Text = ""
nilaikedua.Text = ""
hasil.Text = ""
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
hasil.Text = Val(Nilaipertama.Text) + Val(nilaikedua.Text)
End Sub
Private Sub kurang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kurang.Click
hasil.Text = Val(Nilaipertama.Text) - Val(nilaikedua.Text)
End Sub
Private Sub kali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kali.Click
hasil.Text = Val(Nilaipertama.Text) * Val(nilaikedua.Text)
End Sub
Private Sub bagi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bagi.Click
hasil.Text = Val(Nilaipertama.Text) / Val(nilaikedua.Text)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
1.Design Form seperti yang di bawah ini :
2. Masukan koding program nya :
Public Class Form1
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
Nilaipertama.Text = ""
nilaikedua.Text = ""
hasil.Text = ""
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
hasil.Text = Val(Nilaipertama.Text) + Val(nilaikedua.Text)
End Sub
Private Sub kurang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kurang.Click
hasil.Text = Val(Nilaipertama.Text) - Val(nilaikedua.Text)
End Sub
Private Sub kali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kali.Click
hasil.Text = Val(Nilaipertama.Text) * Val(nilaikedua.Text)
End Sub
Private Sub bagi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bagi.Click
hasil.Text = Val(Nilaipertama.Text) / Val(nilaikedua.Text)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
0 comments:
Post a Comment