Kode Program Tombol Nama Produk :
Private Sub CboPilih_Click()
If CboPilih.Text = "Mouse" Then
TxtHarga.Text = "35000"
ElseIf CboPilih.Text = "Keyboard" Then
TxtHarga.Text = "80000"
ElseIf CboPilih.Text = "CPU" Then
TxtHarga.Text = "300000"
End If
TxtJumlah.SetFocus
End Sub
Kode Sub Form Load :
Private Sub Form_Load()
CboPilih.AddItem "Mouse"
CboPilih.AddItem "Keyboard"
CboPilih.AddItem "CPU"
End Sub
Private Sub CmdHitung_Click()
TxtTotal.Text = Val(TxtUang.Text) - Val(TxtHarga.Text) * Val(TxtJumlah.Text)
End Sub
Kode Program Tombol Beli Lagi :
Private Sub CmdLagi_Click()
TxtID.Text = ""
TxtNama.Text = ""
TxtAlamat.Text = ""
TxtNo.Text = ""
TxtNamaProduk.Text = ""
TxtHarga.Text = ""
TxtJumlah.Text = ""
TxtUang.Text = ""
TxtTotal.Text = ""
TxtID.SetFocus
End Sub
Kode Program Tombol Selesai :
Private Sub CmdSelesai_Click()
Unload Me
End Sub
Kode Program Tombol Enter :
Private Sub TxtTotal_KeyPress(KeyAscii As Integer)
TxtTotal.Text = Val(TxtUang.Text) - Val(TxtHarga.Text) * Val(TxtJumlah.Text)
End Sub
Tidak ada komentar:
Posting Komentar