Selasa, 03 November 2009

Latihan VB Lagi ....


Buat Latihan VB Lagi ........


Scriptnya ceperti ini ...

Private Sub Form_Load()
Combo1.AddItem "KM"
Combo1.AddItem "MJ"
Combo1.AddItem "IP"
Combo1.AddItem "VN"

End Sub

Private Sub cmd_exit_Click()
End
End Sub

Private Sub Combo1_Click()
If (Combo1.Text = "KM") Then
txt_jenis_buku.Text = "Komik"
txt_harga.Text = 250
ElseIf (Combo1.Text = "MJ") Then
txt_jenis_buku.Text = "Majalah"
txt_harga.Text = 200
ElseIf (Combo1.Text = "IP") Then
txt_jenis_buku.Text = "Iptek"
txt_harga.Text = 300
Else
txt_jenis_buku.Text = "Novel"
txt_harga.Text = 350
End If

End Sub

Private Sub DTPicker2_Change()
txt_lama.Text = DTPicker2.Value - DTPicker1.Value
txt_biaya.Text = Val(txt_harga.Text) * Val(txt_lama.Text) * Val(txt_jml_bk.Text)

If (txt_lama.Text > 7) Then
txt_denda.Text = Val(txt_lama.Text - 7) * 100 * Val(txt_jml_bk.Text)
Else
txt_denda.Text = 0
End If

End Sub

Private Sub cmd_hitung_Click()
txt_total.Text = Val(txt_biaya.Text) + Val(txt_denda.Text)
End Sub

Private Sub cmd_tambah_Click()
DTPicker1.Value = Date
DTPicker2.Value = Date
txt_jenis_buku.Text = ""
txt_harga.Text = ""
txt_lama.Text = ""
txt_total.Text = ""
txt_denda.Text = ""
txt_biaya.Text = ""
txt_nama.Text = ""
txt_jml_bk.Text = ""


End Sub

Tidak ada komentar:

Home Again

Bismillah Waktunya pulang.. Alhamdulillah