Materi Ke 7 Visual Foxpro
Transcript of Materi Ke 7 Visual Foxpro
-
8/7/2019 Materi Ke 7 Visual Foxpro
1/4
Lab C Pagi/Foxpro
Pertemuan 7
Merancang Form Menggunakan Object Combo Box
Studi Kasus
1. Buatlah Database Dengan Nama : Data_resto
2. Buatlah Tabel Baru Dengan Nama : Restoran3. Design Struktur Tabel Seperti Dibawah Ini:
5. Ketentuan soal:
Jika Kode =N01 Maka Nasi=Nasi Rames Dan Harga =10000 Jika Kode =N02 Maka Nasi=Nasi Padang Dan Harga =15000
Jika Kode =N03 Maka Nasi=Nasi Kebuli Dan Harga =20000
6.Simpan Form
Dengan Nama :
Resto
7. Buatlah Procedure
Bersih,Nonaktif danTampil.
Nama Field Type Width Index
Nofak Character 5 Primary key(Ascending)
Nama Character 20
Kode Character 3
Nasi Character 10
Harga Numeric 10
Jumlah Numeric 10
Total Numeric 10
-
8/7/2019 Materi Ke 7 Visual Foxpro
2/4
Lab C Pagi/Foxpro
Listing Program!!!!!!!!!!!!!!!!!!
Form1___________________________________LoadCLOSE ALL
SET DEFAULT TO "c:\rny\voxpro"
USE restoran
SET ORDER TO tag nofak
Form1_________________________________Initthisform.combo1.AddItem("N01")
thisform.combo1.AddItem("N02")
thisform.combo1.AddItem("N03")
Form1__________________________________Nonaktifthisform.txtnofak.Enabled=.f.
thisform.txtnama.Enabled=.f.
thisform.combo1.Enabled=.f.
thisform.txtmenu.Enabled=.f.
thisform.txtharga.Enabled=.f.
thisform.txtjumbel.Enabled=.f.
thisform.txttotal.Enabled=.f.thisform.cmdsave.Enabled=.f.
thisform.cmdundo.Enabled=.f.
thisform.cmdbrow.Enabled=.f.
thisform.cmdexit.Enabled=.f.
thisform.cmdproses.Enabled=.f.
thisform.grid1.Enabled=.f.
Form1__________________________________Activatethisform.nonaktif
Cmdadd_________________________________Clickthisform.bersih
thisform.txtnofak.Enabled=.t.thisform.cmdundo.Enabled=.t.
thisform.txtnofak.SetFocus
thisform.cmdAdd.Enabled=.f.
txtnofak____________________________________KeyPressLPARAMETERS nKeyCode, nShiftAltCtrl
IF nkeycode=13
thisform.txtnama.Enabled=.t.
-
8/7/2019 Materi Ke 7 Visual Foxpro
3/4
Lab C Pagi/Foxpro
ENDIF
Txtnama___________________________________KeypresLPARAMETERS nKeyCode, nShiftAltCtrl
IF nkeycode=13
thisform.combo1.Enabled=.t.
ENDIF
Combo1_______________________________________ClickIF thisform.combo1.Value="N01"
thisform.txtmenu.Value="Nasi Rames"
thisform.txtharga.Value=10000
ELSE
IF thisform.combo1.Value="N02"
thisform.txtmenu.Value="Nasi Padang"
thisform.txtharga.Value=15000
ELSE
IF thisform.combo1.Value="N03"
thisform.txtmenu.Value="Nasi Kebuli"
thisform.txtharga.Value=20000
ENDIF
ENDIF
ENDIF
thisform.txtjumbel.Enabled=.t.
thisform.txtjumbel.SetFocus
txtjumbel_____________________________KeypressLPARAMETERS nKeyCode, nShiftAltCtrl
IF nkeycode=13 then
thisform.cmdproses.Enabled=.t.
ENDIF
CmdProses___________________________Clickthisform.txttotal.Value=thisform.txtharga.Value *VAL(thisform.txtjumbel.Value)
thisform.cmdsave.Enabled=.t.
thisform.cmdsave.SetFocus
CmdSave_______________________________ClickAPPEND BLANK
replace nofak WITH thisform.txtnofak.Value
replace nama WITH thisform.txtnama.Value
replace kode WITH thisform.combo1.Value
replace nasi WITH thisform.txtmenu.Value
replace harga WITH thisform.txtharga.Value
replace jumlah WITH VAL(thisform.txtjumbel.Value)replace total WITH thisform.txttotal.Value
thisform.Refresh
thisform.cmdbrow.Enabled=.t.
thisform.cmdexit.Enabled=.t.
CmdBrow____________________________ClickBROWSE
thisform.cmdAdd.Enabled=.t.
-
8/7/2019 Materi Ke 7 Visual Foxpro
4/4
Lab C Pagi/Foxpro
thisform.cmdbrow.Enabled=.t.
thisform.cmdAdd.setfocus
CmdCari____________________________ClickLOCATE FOR nofak=ALLTRIM(thisform.txtnofak.Value)
IF FOUND()
thisform.tampilELSE
MESSAGEBOX("Data Tidak Ada",16,"Info")
thisform.bersih
thisform.cmdadd.SetFocus
ENDIF
thisform.Refresh