Senin, 18 April 2011

Vb

KEYASCII
-> 6=yes, 1=ok, 13=enter.

=> SETFOCUS
[txtjumbel_keypress]
if keyascii = 13 then
txthrg.setfocus
endif
endsub

=> HITUNG
[cmdhitung_click]
txtbayar.text = val(txtharga.text)*(txtjumbel.text)
endsub

=> KELUAR
[cmdkeluar_click]
x = MsgBox("Yakin ingin keluar?", vbQuestion+vbYesNo, "info")
if x = 6 Then
unload me
endif
endsub
Nb:vbquestion/critical/exclamation

=> NONAKTIF
[private sub nonaktif()]
txtnama.enabled=false
endsub

=> AKTIF
[private sub aktif()]
txtnama.enabled=true
endsub

=> BERSIH
[private sub bersih()]
txtnama.text=""
txtharga.text=0
option1.value=false
endsub

=> ACTIVATE
[private sub form_activate]
nonaktif
endsub

=> PERHITUNGAN OTOMATIS TAMPIL
[txtubay_change]
txtukem.text = val(txtubay.text)-(txttotal.text)
endsub

=> PERHITUNGAN ENTER TAMPIL
[txtubay_keypress]
if keyAscii=13 then
txtukem.text = val(txtubay.text)-(txttotal.text)
end if
endsub

=> CONTOH IF
[cmbukuran_click]
if silverqueen.value=1 then
if cmbukuran.text="small" then
harga.text=4000
else if cmbukuran.text="medium" then
harga.text=5000
else
harga.text=6000
endif
else if tobleron.value=1 then
dst...

=> CONTOH FUNCTION
[function proses()]
select case kode.text
case"DRT"
jabatan.text="Direktur"
gapok.text=5juta
case"MNG"
jabatan.text="manager"
gapok.text=3juta
endselect
endfunction

=> MENDEKLARASI VARIABEL DAN SIMPAN
[general]
Dim ke, jml(10) as byte
Dim kode(10), nama(10) as string
Dim harga(10), total(10) as currency
[cmdsimpan_click]
on error resume next
ke = val(barangke.text)
if ke >= 10 then
psn = msgbox "Data melebihi kapasitas", vbexclamation, "perhatian"
cmdbersih_click
else
ke = val(barangke.text)
kode(ke) = txtkode.text
nama(ke) = txtnama.text
harga(ke) = txtharga.text
jml(ke) = txtjml.text
total(ke) = txttotal.text
msgbox "Data telah tersimpan", vbexclamation, "info"
endif

=> LIHAT DATA
[Cmdlihat_click]
ke=val(txtlihat.text)
txtkode.text=kode(ke)
txtnama.text=nama(ke)
dst..



=> PEMBAYARAN KURANG
[txtbayar_keypress]
if keyascii=13 Then
if val(txtbayar.text)= asc("0") and keyascii <= asc ("9") or keyascii = vbkeyback) then key ascii = 0 endsub => TANGGAL
[private sub timer1_timer()]
tgl.text=format(date, "dd mmm yyyy")
endsub

=> MENGISI LIST BOX
[private sub form_activate()]
list1. Additem "im3"
list1. Additem "mentari"
list1. Additem "simpati"
endsub

=> [private sub clima_click()]
if clima.value=checked then
if list1.listindex=0 then
lima.text=val(jumbel.text)*6000
else if list1.listindex=1 then
lima.text=val(jumbel.text)*7000
else
lima.text=val(jumbel.text)*8000
endif
else lima.text=0
endif
endsub

Tidak ada komentar:

Posting Komentar