Latihan Perhitungan Aritmatika

Coding nya :
Public Class Frlatihan3
Private Sub btClose_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btClose.Click
Me.Close()
End Sub
Private Sub txtBil1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
txtBil1.KeyPress
If
e.KeyChar = Chr(13) Then
Me.txtBil2.Focus()
End If
End Sub
Private Sub txtBil2_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
txtBil2.KeyPress
If
e.KeyChar = Chr(13) Then
Me.btNew.Focus()
End If
End Sub
Private Sub btNew_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btNew.Click
Me.txtBil1.Clear()
Me.txtBil2.Clear()
Me.txtHasil.Clear()
Me.txtBil1.Focus()
End Sub
Private Sub Frlatihan3_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'---Mengisi
proferti objek Form
Me.Text
= "Latihan Perhitungan Aritmatika"
End Sub
Private Sub btTambah_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btTambah.Click
Dim b1,
b2 As New Integer
Dim h As New Double
b1 = Val(txtBil1.Text)
b2 = Val(txtBil2.Text)
h = b1 + b2
txtHasil.Text = h
End Sub
Private Sub btKurang_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btKurang.Click
Dim b1, b2 As New Integer
Dim h As New Double
b1 = Val(txtBil1.Text)
b2 = Val(txtBil2.Text)
h = b1 - b2
txtHasil.Text = h
End Sub
Private Sub btKali_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btKali.Click
Dim b1,
b2 As New Integer
Dim h As New Double
b1 = Val(txtBil1.Text)
b2 = Val(txtBil2.Text)
h = b1 * b2
txtHasil.Text = h
End Sub
Private Sub btBagi_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btBagi.Click
Dim b1,
b2 As New Integer
Dim h As New Double
b1 = Val(txtBil1.Text)
b2 = Val(txtBil2.Text)
h = b1 / b2
txtHasil.Text = h
End Sub
End Class
Download di sini PDF






0 komentar:
Post a Comment