Contoh Form nya yang saya buat adalah seperti pada gambar di bawah ini.
Untuk Codingan pada setiap Button nya adalah sebagai berikut :
Source Code "Tambah" |
IF thisform.command1.Caption="tambah"
thisform.command1.caption="save"
thisform.command2.Enabled=.F.
thisform.command3.Enabled=.F.
thisform.command4.Enabled=.F.
thisform.command5.Enabled=.f.
thisform.hidup
thisform.kosong
thisform.text1.SetFocus
ELSE
APPEND BLANK
replace kodebrg WITH thisform.text1.value
replace namabrg WITH thisform.text2.value
thisform.mati
thisform.command2.Enabled=.T.
thisform.command3.Enabled=.T.
thisform.command4.Enabled=.T.
thisform.command5.Enabled=.T.
ENDIF
thisform.command1.caption="save"
thisform.command2.Enabled=.F.
thisform.command3.Enabled=.F.
thisform.command4.Enabled=.F.
thisform.command5.Enabled=.f.
thisform.hidup
thisform.kosong
thisform.text1.SetFocus
ELSE
APPEND BLANK
replace kodebrg WITH thisform.text1.value
replace namabrg WITH thisform.text2.value
thisform.mati
thisform.command2.Enabled=.T.
thisform.command3.Enabled=.T.
thisform.command4.Enabled=.T.
thisform.command5.Enabled=.T.
ENDIF
Source Code "Edit" |
IF thisform.command2.caption="edit"
thisform.command2.Caption="save"
thisform.hidup
thisform.command4.Enabled=.F.
thisform.command3.Enabled=.F.
thisform.command1.Enabled=.F.
thisform.command5.Enabled=.F.
thisform.text1.SetFocus
ELSE
replace kodebrg WITH thisform.text1.Value
replace namabrg with thisform.text2.Value
thisform.command4.Caption="edit"
thisform.mati
thisform.command2.Enabled=.T.
thisform.command3.enabled=.T.
thisform.command1.Enabled=.T.
thisform.command5.Enabled=.T.
endif
thisform.command2.Caption="save"
thisform.hidup
thisform.command4.Enabled=.F.
thisform.command3.Enabled=.F.
thisform.command1.Enabled=.F.
thisform.command5.Enabled=.F.
thisform.text1.SetFocus
ELSE
replace kodebrg WITH thisform.text1.Value
replace namabrg with thisform.text2.Value
thisform.command4.Caption="edit"
thisform.mati
thisform.command2.Enabled=.T.
thisform.command3.enabled=.T.
thisform.command1.Enabled=.T.
thisform.command5.Enabled=.T.
endif
Source Code "Maju" |
IF EOF()
GO top
thisform.tampil
ELSE
SKIP
thisform.tampil
ENDIF
GO top
thisform.tampil
ELSE
SKIP
thisform.tampil
ENDIF
Source Code "Mundur" |
IF BOF()
GO bottom
thisform.tampil
ELSE
SKIP -1
thisform.tampil
ENDIF
GO bottom
thisform.tampil
ELSE
SKIP -1
thisform.tampil
ENDIF
Source Code "Hapus" |
IF EOF()
GO top
ENDIF
hapus=MESSAGEBOX("yakin akan di hapus data ini?",32+1,"konfirmasi Hapus")
IF hapus = 1
DELETE
PACK
SKIP
thisform.tampil
ELSE
MESSAGEBOX("Batal HAPUS",0,"Attention")
ENDIF
ENDIF
hapus=MESSAGEBOX("yakin akan di hapus data ini?",32+1,"konfirmasi Hapus")
IF hapus = 1
DELETE
PACK
SKIP
thisform.tampil
ELSE
MESSAGEBOX("Batal HAPUS",0,"Attention")
ENDIF
Source Code "Tampil" |
Brows
Source Code "Keluar" |
thisform.Release
Ok Sobat Blogger.. Demikian lah Source Code Untuk setiap Button - button pada Visual FoxPro,untuk Pembuatan Program nya nanti akan saya buatkan..
Terima kasih Atas kunjungan Anda.. Salam Blogger.