Pemrograman Visual:Latihan Ujian: Difference between revisions

No edit summary
No edit summary
Line 112: Line 112:
     End Sub
     End Sub
End Class
End Class
</syntaxhighlight>Kode dibawah ini di event <code>btnBersihkan_Click</code> digunakan untuk mengosongkan semua input pada form, sedangkan pada event <code>btnKeluar_Click</code> digunakan untuk menutup form.<syntaxhighlight lang="vbscript" line="1">
</syntaxhighlight>Kode dibawah ini di event <code>btnBersihkan_Click</code> digunakan untuk mengosongkan semua input pada form, sedangkan pada event <code>btnKeluar_Click</code> digunakan untuk menutup form.
 
<syntaxhighlight lang="vbscript" line="1">
Public Class Form1
Public Class Form1


Line 150: Line 152:
     End Sub
     End Sub


     Private Sub txtJumlahHari_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtJumlahHari.TextChanged
     Private Sub txtJumlahHari_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtJumlahHari.TextChanged
         Dim harga As Integer
         Dim harga As Integer
         harga = Val(txtSewaPerHari.Text)
         harga = Val(txtSewaPerHari.Text)
         txtJumlahBayar.Text = harga * Val(txtJumlahHari.Text)
         txtJumlahBayar.Text = harga * Val(txtJumlahHari.Text)
     End Sub
     End Sub
   
 
     Private Sub btnBersihkan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBersihkan.Click
     Private Sub btnBersihkan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBersihkan.Click
         cboJenis.Text = ""
         cboJenis.Text = ""
Line 161: Line 163:
         txtSewaPerHari.Text = ""
         txtSewaPerHari.Text = ""
         txtJumlahBayar.Text = ""
         txtJumlahBayar.Text = ""
        txtNamaPenyewa.Text = ""
        txtNomorSewa.Text = ""
     End Sub
     End Sub