Ini Foto Ane Walaupun Jelek Gak Apalah |
saya membuat program FP ini hanya sekedar dari hobby program, bagi yang mempunyai kemampuan lebih mari kita saling berbagi email saya disiniagoknyoman_90@yahoo.co.id
Membuat Sebuah Aplikasi pada Visual Foxpro
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 |
# 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
CARA MEMBUAT KALKULATOR SEDERHANA
Hallo gan, hari ini saya akan membagikan sebuah code yang digunakan untuk membuat sebuah program calculator sederhana. jika sebelumnya saya telah membagikan sebuah code Program Free Pacal, maka kali ini saya membagikan code Program Visual FoxPro. langsung saja dipraktekin.
1. Hal pertama yang harus agan pikirkan dalam membuat sebuah calculator sederhana adalah tampilan dari calculator yang nantinya agan buat. Dalam membuat calculator sederhana dengan menggunakan Mocrosof Visual FoxPro, agan harus dapat berkreasi sekreatif mungkin, agar tampilan dari calculator yang nantinya agan buat dapat diminati oleh banyak orang. Disini saya akan memberikan contoh tampilan calculator yang telah saya buat.
Tampilan diatas merupakan tampilan calculator yang telah saya. agan boleh ikuti tampilan ini dan lebih bagus lagi kalau agan punya tampilan calculator yang lbih bagus lagi.
2. Setelah tampilan calculator selesai agan buat, maka tahap selanjutnya dalam pembuatan calculator sederhana adalah pemberian perintah. untuk perintah tombol 1 harus memasukkan kode di bawah ini.
Ingat ini adalah code untuk tombol 1, jadi untuk tombol 2 sampai dengan tombol 0 tinggal merubah angka 1 terakhir dengan angka yang sesuai dengan jenis tombol. Contoh jika angka 2 maka code terakhirnya adalah Value+'2'
3. Selanjutnya, memasukkan code dibawah ini untuk tombol tambah, kurang, kali dan bagi.
Code di atas adalah code untuk tombol tambah, jadi untuk code tombol kurang, kali dan bagi tinggal merubah kata "tambah" dengan kata kurang, kali atau pun bagi.
4. Setelah itu, memasukkan code untuk tombol bersih. code yang dibutuhkan sangat simpel yaitu...
5. Selanjutnya code untuk hasil yaitu
6. Setelah memasukkan code untuk tombol hasil, maka selanjutnya adalah tombol untuk keluar.
Code diatas sedikit rumit, tapi jika tidak ingin repot, agan boleh saja meggunakan code "thisform.release". Code ini sama saja dengan code yang ada pada gambar, terserah mau pilih yang mana.
7. Setelah selesai memasukkan code untuk semua tombol maka tahap selanjutnya adalah memasukkan code untuk formnya. codenya yaitu
Perhatikan pada bagian prosedur, bukan lagi menggunakan prosedur clik seperti tombol-tombol sebelumnya, untuk code form harus menggunakan prosedur load.
Itulah sedikit mengenai Cara Membuat Calculator Sederhana Menggunakan Microsof isual FoxPro semoga dapat bermanfaat.
OK NEXT PAGE
Cara Membuat Program Biodata Dengan FOXPRO Selain FOXPRO Masih Ada Bahasa program Antaranya DELPHI, VISUAL BASIC, PASCAl Dll... Ok Gan Kita Lanjutt...
Om Swastyastu
Kali ini saya hanya posting ulang hasil pikiran orang sebuah program Entri Data Siswa Sederhana yang mudah dipahami. Oke.. Langsung saja kita mulai
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
= 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
1. Hal pertama yang harus agan pikirkan dalam membuat sebuah calculator sederhana adalah tampilan dari calculator yang nantinya agan buat. Dalam membuat calculator sederhana dengan menggunakan Mocrosof Visual FoxPro, agan harus dapat berkreasi sekreatif mungkin, agar tampilan dari calculator yang nantinya agan buat dapat diminati oleh banyak orang. Disini saya akan memberikan contoh tampilan calculator yang telah saya buat.
Tampilan diatas merupakan tampilan calculator yang telah saya. agan boleh ikuti tampilan ini dan lebih bagus lagi kalau agan punya tampilan calculator yang lbih bagus lagi.
2. Setelah tampilan calculator selesai agan buat, maka tahap selanjutnya dalam pembuatan calculator sederhana adalah pemberian perintah. untuk perintah tombol 1 harus memasukkan kode di bawah ini.
Ingat ini adalah code untuk tombol 1, jadi untuk tombol 2 sampai dengan tombol 0 tinggal merubah angka 1 terakhir dengan angka yang sesuai dengan jenis tombol. Contoh jika angka 2 maka code terakhirnya adalah Value+'2'
3. Selanjutnya, memasukkan code dibawah ini untuk tombol tambah, kurang, kali dan bagi.
Code di atas adalah code untuk tombol tambah, jadi untuk code tombol kurang, kali dan bagi tinggal merubah kata "tambah" dengan kata kurang, kali atau pun bagi.
4. Setelah itu, memasukkan code untuk tombol bersih. code yang dibutuhkan sangat simpel yaitu...
5. Selanjutnya code untuk hasil yaitu
6. Setelah memasukkan code untuk tombol hasil, maka selanjutnya adalah tombol untuk keluar.
Code diatas sedikit rumit, tapi jika tidak ingin repot, agan boleh saja meggunakan code "thisform.release". Code ini sama saja dengan code yang ada pada gambar, terserah mau pilih yang mana.
7. Setelah selesai memasukkan code untuk semua tombol maka tahap selanjutnya adalah memasukkan code untuk formnya. codenya yaitu
Perhatikan pada bagian prosedur, bukan lagi menggunakan prosedur clik seperti tombol-tombol sebelumnya, untuk code form harus menggunakan prosedur load.
Itulah sedikit mengenai Cara Membuat Calculator Sederhana Menggunakan Microsof isual FoxPro semoga dapat bermanfaat.
OK NEXT PAGE
Cara Membuat Program Biodata Dengan FOXPRO Selain FOXPRO Masih Ada Bahasa program Antaranya DELPHI, VISUAL BASIC, PASCAl Dll... Ok Gan Kita Lanjutt...
Membuat Program Biodata di Visual FoxPro
Cara Membuat Program Biodata di Visual FoxPro
Teman Teman sekalian kali ini kita akan mencoba membuat program biodata dengan Visual Voxpro.
Pertama buatlah tampilan seperti dibawah ini:
Yang dibutuhkan adalah label,textbox dan command button..
ini script dari program tersebut:
script untuk Input :
thisform.label6.Caption="NPM :"+thisform.text1.Value
thisform.label7.Caption="NAMA :"+thisform.text2.Value
thisform.label8.Caption="KELAS :"+thisform.text3.Value
thisform.label9.Caption="ALAMAT :"+thisform.text4.Value
thisform.label10.Caption="JURUSAN :"+thisform.text5.Value
script untuk Reset:
thisform.text1.Value=""
thisform.text2.Value=""
thisform.text3.Value=""
thisform.text4.Value=""
thisform.text5.Value=""
thisform.label6.Caption="-"
thisform.label7.Caption="-"
thisform.label8.Caption="-"
thisform.label9.Caption="-"
thisform.label10.Caption="-"
script untuk exit:
thisform.Release
Untuk menjalankannya tekan tombol ctrl+e
hasilnya seperti ini:
Teman Teman sekalian kali ini kita akan mencoba membuat program biodata dengan Visual Voxpro.
Pertama buatlah tampilan seperti dibawah ini:
Yang dibutuhkan adalah label,textbox dan command button..
ini script dari program tersebut:
script untuk Input :
thisform.label6.Caption="NPM :"+thisform.text1.Value
thisform.label7.Caption="NAMA :"+thisform.text2.Value
thisform.label8.Caption="KELAS :"+thisform.text3.Value
thisform.label9.Caption="ALAMAT :"+thisform.text4.Value
thisform.label10.Caption="JURUSAN :"+thisform.text5.Value
script untuk Reset:
thisform.text1.Value=""
thisform.text2.Value=""
thisform.text3.Value=""
thisform.text4.Value=""
thisform.text5.Value=""
thisform.label6.Caption="-"
thisform.label7.Caption="-"
thisform.label8.Caption="-"
thisform.label9.Caption="-"
thisform.label10.Caption="-"
script untuk exit:
thisform.Release
Untuk menjalankannya tekan tombol ctrl+e
hasilnya seperti ini:
Aplikasi Entri Data Siswa Visual Foxpro
Kali ini saya hanya posting ulang hasil pikiran orang sebuah program Entri Data Siswa Sederhana yang mudah dipahami. Oke.. Langsung saja kita mulai
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
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