Latihan : Kartu Hasil Studi Mahasisw
1. Buatlah Project dengan nama : khs.pjx
2. Buatlah Database didalam project : datakhs.dbc
3. Buatlah Tabel-tabel dibawah ini.
Tabel : mhs.dbf
Name type Width Index
Nim Character 8 Primary/Descending(↓)
Nama Character 30
Jur Character 2
Jnskel Character 10
alamat Memo 4
telp Character 13
foto General 4
4. Buatlah form dengan tampilan sebagai berikut : frm_mhs.scx
Properties
Object | Name | Lain-lain |
Form1 | Form1 | Caption=FORM MAHASISWA |
Text1 | Txtnim | |
Text2 | Txtnama | |
Combo1 | Cjur | Row Source=KA,MI,TK Row Source Type=1-Value |
Optiongroup1 | Ojns | |
Option1 | Opl | Caption=Laki-laki |
Option2 | Opp | Caption=Perempuan |
Edit1 | Ealmt | |
Text3 | Txttelp | Input Mask=999-9999999999 |
Command1 | Cmdadd | |
Command2 | Cmdcancel | |
Command3 | Cmdsave | |
Command4 | Cmdedit | |
Command5 | Cmddelete | |
Command6 | Cmdexit | |
Text3 | Txtcari | |
Command7 | Cmdfind | |
Timer1 | Timer1 | Interval=100 |
Text4 | Txtdatetime | Alignment=2-Center |
Command7 | Cmdupload | Caption=\<UPLOAD |
Image2 | Image_foto | Visible=false |
Olebondcontrol1 | Olefoto | Visible=false |
# Buatlah methode : aktif, nonaktif, bersih, simpan, tampil, urut
# Listing Program frm_mhs.scx
Form1 activate
thisform.nonaktif
thisform.bersih
thisform.txtnim.Enabled= .F.
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.AutoCenter= .T.
thisform.Caption=”FORM MAHASISWA”+SPACE(100)
Form1 load
SET DEFAULT TO c:\pagi\kelas\nim\khs&&mengaktifkan path folder
USE mhs &&mengaktifkan table mhs.dbf
SET ORDER TO tag nim &&menggunakan key nim
PUBLIC no &&PUBLIC berfungsi untuk membuat variabel secara global
PUBLIC isi,lcgambar
SET DATE ITALIAN
Form1 aktif
thisform.txtnama.Enabled= .T.
thisform.cjur.Enabled= .T.
thisform.ojns.Enabled= .T.
thisform.ealmt.Enabled= .T.
thisform.txttelp.Enabled= .T.
thisform.olefoto.Enabled= .T.
thisform.cmdupload.Enabled= .T.
Form1 nonaktif
thisform.txtnama.Enabled= .F.
thisform.cjur.Enabled= .F.
thisform.ojns.Enabled= .F.
thisform.ealmt.Enabled= .F.
thisform.txttelp.Enabled= .F.
thisform.olefoto.Enabled= .F.
thisform.cmdupload.Enabled= .F.
Form1 bersih
thisform.txtnim.Value=””
thisform.txtnama.Value=””
thisform.cjur.Value=””
thisform.ojns.Value=0
thisform.ealmt.Value=””
thisform.txttelp.Value=””
thisform.olefoto.Visible= .F.
thisform.image_foto.Visible= .F.
Form1 tampil
thisform.txtnim.Value=mhs.nim
thisform.txtnama.Value=mhs.nama
thisform.cjur.Value=mhs.jur
IF mhs.jnskel=”Laki-laki” then
thisform.ojns.opl.Value=1
thisform.ojns.opp.Value=0
ELSE
IF mhs.jnskel=”Perempuan” then
thisform.ojns.opl.Value=0
thisform.ojns.opp.Value=1
ENDIF
ENDIF
thisform.ealmt.Value=mhs.alamat
thisform.txttelp.Value=mhs.telp
thisform.olefoto.ControlSource=”mhs.foto”
thisform.olefoto.Visible= .T.
Form1 urut
no=INT(VAL(RIGHT(mhs.nim,4))+1)
no=REPLICATE(“0”,+4-LEN(LTRIM(STR(no))))+LTRIM(STR(no))
Form1 simpan
replace nim WITH thisform.txtnim.Value
replace nama WITH thisform.txtnama.Value
replace jur WITH thisform.cjur.Value
IF thisform.ojns.opl.Value=1 then
thisform.ojns.opp.Value=0
replace jnskel WITH thisform.ojns.opl.Caption
ELSE
IF thisform.ojns.opp.Value=1 then
thisform.ojns.opl.Value=0
replace jnskel WITH thisform.ojns.opp.Caption
ENDIF
ENDIF
replace alamat WITH thisform.ealmt.Value
replace telp WITH thisform.txttelp.Value
APPEND GENERAL foto FROM ALLTRIM(lcgambar)
cmdadd click
isi=.t.
thisform.aktif
thisform.bersih
thisform.cmdcancel.Enabled= .T.
thisform.cmdsave.Enabled= .T.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .F.
thisform.txtnama.SetFocus
cmdcancel click
thisform.bersih
thisform.nonaktif
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.Refresh
cmdedit click
isi=.f.
thisform.aktif
thisform.cjur.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdsave.Enabled= .T.
thisform.cmdcancel.Enabled= .T.
cmdexit click
quit
cmdsave click
IF EMPTY(thisform.txtnim.Value) OR;
EMPTY(thisform.txtnama.Value) OR;
EMPTY(thisform.cjur.Value) OR;
thisform.ojns.Value=0 OR;
EMPTY(thisform.ealmt.Value) OR;
EMPTY(thisform.txttelp.Value) OR;
EMPTY(lcgambar) then
MESSAGEBOX(“DATA HARUS DI ISI LENGKAP”,48,”WARNING”)
RETURN
ENDIF
IF isi=.t. THEN &&penyimpanan awal sebelum di edit
APPEND BLANK &&membuat record kosong
thisform.simpan
MESSAGEBOX(“DATA TELAH TERSIMPAN”,64,”INFO”)
ELSE
IF isi=.f. THEN &&penyimpanan data setelah di edit
thisform.simpan
MESSAGEBOX(“DATA TELAH TERUPDATE”,64,”INFO”)
ENDIF
thisform.nonaktif
thisform.bersih
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.Refresh
cmddelete click
hapus=MESSAGEBOX(“Data Mahasiswa dengan NIM “+thisform.txtnim.Value+;
” ingin dihapus?”,36,”INFO”)
IF hapus=6 then
DELETE
PACK
ENDIF
thisform.bersih
thisform.cmddelete.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmdadd.Enabled= .T.
cmduplad click
lcgambar=””
lcgambar=GETFILE(“BMP”)
thisform.image_foto.Stretch= 2
thisform.image_foto.Picture=ALLTRIM(lcgambar)
thisform.image_foto.Visible= .T.
Timer1 timer
thisform.txtdatetime.Value=DATETIME()
teks=thisform.caption
thisform.caption=right(teks,len(teks)-1)+left(teks,1)
cjur click
IF thisform.cjur.Value=”KA” then
SEEK ALLTRIM(“11″)
thisform.urut
thisform.txtnim.Value=”11″+RIGHT(DTOC(DATE()),2)+no
ELSE
IF thisform.cjur.Value=”MI” then
SEEK ALLTRIM(“12″)
thisform.urut
thisform.txtnim.Value=”12″+RIGHT(DTOC(DATE()),2)+no
ELSE
IF thisform.cjur.Value=”TK” then
SEEK ALLTRIM(“13”)
thisform.urut
thisform.txtnim.Value=”13″+RIGHT(DTOC(DATE()),2)+no
ENDIF
ENDIF
ENDIF
cmdfind click
SET ORDER TO tag nim
IF SEEK(ALLTRIM(thisform.txtcari.Value))
thisform.tampil
thisform.cmdedit.Enabled= .T.
thisform.cmddelete.Enabled= .T.
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdadd.Enabled= .F.
ELSE
MESSAGEBOX(“Data tidak ada!!”,64,”INFO”)
thisform.txtcari.SetFocus
ENDIF
thisform.txtcari.Value=””
thisform.Refresh
wao…goog share
Makasih abang 🙂
wahhh mantappp gan….
ajarin saya yaaa guru..
guru??coba jangan merendah ahh suhu!
wahh coba suhu jangan merendah gitu ahh 🙂
xixixixi nggak nyangka. Sy kira cuma bisa jadi sastrawan kamu eh nggak taunya bisa juga jadi programmer.
wkwkwkwk…kan aku mau jadi dua2nya pak 🙂 heheh 🙂 alhamdulillah sekarang kerjaan sebagai IT billing pak, makanya tertuntut harus selalu belajar pemrograman…tapi ternyata belajar pemrograman gak segampang belajar sastra pak hahahah 🙂
saya lagi dapet tugas tentang visual foxpro…
bisa bantu saya nda ???
mhon di bls scpt`y…
mksh ya…
saya bukan ahlinya mas, itu postingan ketika aku lagi iseng2nya blajar foxpro…
skarang masi bisa kan foxprox mba?
kayaknya dah lupa heheheh
ad g contoh yang laen e ??? soale ak juga pgn beljr foxpro
trims 🙂
nah mw contoh yg gimana gan?
dibuku teritorialnya lmyn lengkap bentuk pdf……
tp jjr aq jg belum nguasainya coz masi jauh dari programer…..
This post couldn’t be more factual..
kalau data base nya pake ms access cara menghubungkan nya gimana ya..
nah itu susah mass mass make ms office brpa?
03 atw 07?
kalo cara bikin sistem pakar di foxpro harus pake code nya apa yah soal nya saya kok gagal terus????? tolong kasih tahu cara nya….
mesti trial and error terus mbak putri…kalo saya juga masih newbie…jadi kurang paham 🙂
mantab……. cantik-cantik ternyata programmer….
waduh, saya ganteng mas wkwkwkkw…gak kok gk programmer cuma lagi belajar ajah…
wet’s maen fox juga,….
mantafff…
ajarin dong sist..
bagaimana memindahkan isi record ke record yang lain dalam visual foxpro
bagaimna membuat report khs pada visual foxpro
Maaf mau nanya, bagaimana cara menginput data melalui grid, yang datanya diambil dari tebel lain dan kemudian disimpan ke dalam tabel sendiri….
cara agar inputan baru berada pada urutan atas tabel GRD gimana ya???
Cara memakai timer di foxpro bagaimana ya ?