Senin, 23 Juli 2012

Membuat input Data dengan Foxpro

-Pertama-tama buka foxpro sobat
-Setelah terbuka File > New




-Pilih Form > New File
-maka akan tampil form kosong
-Buatlah Designnya agar tampak menarik

-Ketik Kodingnya
Form1 procedur Init
thisform.text1.value=""
thisform.text2.value=""
thisform.text3.value=DATE()
thisform.text4.value=""
thisform.text5.value=""
thisform.combo1.value=""
thisform.optiongroup1.value=1
thisform.image1.Picture=""
thisform.text1.SetFocus

Form1 procedur Load
 CLOSE DATABASES
SET TALK OFF
SET ECHO OFF
SET SAFETY OFF
USE karyawan
INDEX on nip TO karyawan
SET INDEX TO karyawan

Form1 procedur Unload
CLOSE DATABASES

Command  Cari procedur Click

vNIP=ALLTRIM(thisform.text1.Value)
SEEK vNIP
IF FOUND()
thisform.text1.Value=nip
thisform.text2.Value=nama
thisform.text3.Value=tgllahir
thisform.text4.Value=tempatlahir
thisform.combo1.Value=gol
IF jnskel
thisform.optiongroup1.Value=2
ELSE
thisform.optiongroup1.Value=1
ENDIF
thisform.text5.Value=alamat
thisform.image1.picture=gambar
ELSE
MESSAGEBOX("Data Tidak Ditemukan")
thisform.Init
thisform.text1.SetFocus()
ENDIF

Command Simpan procedur Click


APPEND BLANK
replace nip WITH thisform.text1.Value
replace nama WITH thisform.text2.Value
replace tgllahir WITH thisform.text3.Value
replace tempatlahir WITH thisform.text4.Value
replace gol WITH thisform.combo1.Value
IF thisform.optiongroup1.Value=1
replace jnskel with .T.
ELSE
replace jnskel with .F.
ENDIF
replace alamat WITH thisform.text5.value
replace gambar WITH thisform.image1.picture
thisform.Grid1.Refresh
thisform.Init

Command Browse Procedur Click
BROWSE

Command Edit Data procedur Click
IF thisform.command5.Caption="\<EDIT DATA"
thisform.command2.Caption="\SIMPAN"
thisform.command6.Caption="\HAPUS"
thisform.text2.Enabled=.T.
thisform.text3.Enabled=.T.
thisform.text4.Enabled=.T.
thisform.text5.Enabled=.T.
thisform.combo1.Enabled=.T.
thisform.optiongroup1.Enabled=.T.
thisform.text2.SetFocus
ELSE
IF thisform.command2.Caption="\<SIMPAN"
thisform.command5.Caption="\EDIT DATA"
thisform.command6.Caption="\HAPUS"
replace nip WITH thisform.text1.value
replace nama WITH thisform.text2.value
replace tgllahir WITH thisform.text3.value
replace tempatlahir WITH thisform.text4.value
replace gol WITH thisform.combo1.value
IF thisform.optiongroup1.Value=1
replace jnskel WITH .T.
ELSE
replace jnskel WITH .F.
ENDIF
replace alamat WITH thisform.text5.value
thisform.Grid1.Refresh
thisform.Init
ENDIF
ENDIF

Command Hapus Prcedur Click
Tombol=thisform.command6.Caption
IF Tombol="\<HAPUS"
DELETE
PACK
ELSE
thisform.command5.Caption="\<EDIT DATA"
ENDIF
thisform.Grid1.Refresh
thisform.Init

Command Laporan Procedur Click
REPORT FORM laporan preview

Command Cari Foto Procedur Click
Local nFile
nFile=""
nFile=GETPIC("JPG","d:/foto/darryl","Buka")
thisform.image1.picture=nFile



Maka Akan Tampil Seperti ini

Dan Bentuk Reportnya Akan Menjadi Seperti ini













0 komentar:

Posting Komentar