code form
Bài 1: Hiển Thị Danh Sách Lớp
CMDDAU.CLICK
GO TOP
THISFORM.REFRESH
CMDCUOI.CLICK
GO BOTTOM
THISFORM.REFRESH
CMDTRUOC.CLICK
IF NOT BOF()
SKIP -1
ENDI
THISFORM.REFRESH
CMDSAU.CLICK
IF NOT EOF()
SKIP
ENDI
THISFORM.REFRESH
CMDTHEM.CLICK
APPE BLAN
THISFORM.TXTMALOP.SETFOCUS
THISFORM.REFRESH
CMDXOA.CLICK
N=MESSAGEBOX ("CO XOA BAN GHI NAY KHONG ?",1,"THONG BAO")
IF N=1
DELE
PACK
ENDI
THISFORM.REFRESH
CMDSUA.CLICK
THISFORM.TXTMALOP.SETFOCUS
THISFORM.TXTTENLOP.SETFOCUS
THISFORM.TXTPHONGHOC.SETFOCUS
EDIT
THISFORM.REFRESH
CMDKETTHUC.CLICK
THISFORM.RELEASE
Bài 2: Hiển Thị Danh Sách Sinh Viên
CMDHIENTHI.CLICK
SET FILT TO ALLT(UPPE(THISFORM.TXTDK.VALUE))=ALLT(UPPE(MALOP))
COUNT TO X
IF X=0
MESSAGEBOX("KHONG CO LOP NAY",0,"THONG BAO")
THISFORM.TXTDK.VALUE=""
THISFORM.TXTDK.SETFOCUS
ELSE
THISFORM.GRDLUOI.VISIBLE=.T.
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
THISFORM.TXTKQ.VALUE=STR(X)
ENDI
THISFORM.REFRESH
CMDXOA.CLICK
THISFORM.GRDLUOI.VISIBLE=.F.
THISFORM.LBLKQ.VISIBLE=.F.
THISFORM.TXTKQ.VISIBLE=.F.
THISFORM.TXTDK.VALUE=""
THISFORM.REFRESH
CMDINAN.CLICK
REPORT FORM DSLOP PREV FOR
ALLT(UPPE(THISFORM.TXTDK.VALUE))=ALLT(UPPE(MALOP))
CMDKETTHUC.CLICK
THISFORM.RELEASE
Bài 3: Nhập Thông Tin Lớp
CMDLUU.CLICK
APPE BLAN
REPL MALOP WITH THISFORM.TXTMALOP.VALUE
REPL TENLOP WITH THISFORM.TXTTENLOP.VALUE
REPL PHONGHOC WITH THISFORM.TXTPHONGHOC.VA
THISFORM.TXTMALOP.VALUE=""
THISFORM.TXTTENLOP.VALUE=""
THISFORM.TXTPHONGHOC.VALUE=""
THISFORM.REFRESH
CMDKETTHUC.CLICK
THISFORM.RELEASE
Bài 4: Cập Nhật Lớp Mới
CMDCAPNHAT.CLICK
IF ALLT(THISFORM.TXTMALOP.VALUE)==""
MESSAGEBOX("XIN LOI, MA RONG",0,"THONG BAO")
THISFORM.TXTMALOP.SETFOCUS
ELSE
LOCA FOR ALLT(THISFORM.TXTMALOP.VALUE)=ALLT(MALOP)
IF !FOUN()
APPE BLAN
REPL MALOP WITH THISFORM.TXTMALOP.VALUE
REPL TENLOP WITH THISFORM.TXTTENLOP.VALUE
REPL PHONGHOC WITH THISFORM.TXTPHONGHOC.VALUE
THISFORM.TXTMALOP.VALUE=""
THISFORM.TXTTENLOP.VALUE=""
THISFORM.TXTPHONGHOC.VALUE=""
ELSE
MESSAGEBOX("XIN LOI, MA LOP TRUNG",0,"THONG BAO")
THISFORM.TXTMALOP.SETFOCUS
THISFORM.TXTMALOP.VALUE=""
THISFORM.TXTTENLOP.VALUE=""
THISFORM.TXTPHONGHOC.VALUE=""
ENDI
ENDI
THISFORM.REFRESH
CMDKETTHUC.CLICK
THISFORM.RELEASE
Bài 5: Cập Nhật Lớp Mới (Xem CSDL)
CMDCAPNHAT.CLICK
IF ALLT(THISFORM.TXTMALOP.VALUE)==""
DO FORM TBMALOPRONG
ELSE
LOCA FOR ALLT(THISFORM.TXTMALOP.VALUE)=ALLT(MALOP)
IF !FOUN()
APPE BLAN
REPL MALOP WITH THISFORM.TXTMALOP.VALUE
REPL TENLOP WITH THISFORM.TXTTENLOP.VALUE
REPL PHONGHOC WITH THISFORM.TXTPHONGHOC.VALUE
THISFORM.TXTMALOP.VALUE=""
THISFORM.TXTTENLOP.VALUE=""
THISFORM.TXTPHONGHOC.VALUE=""
ELSE
DO FORM TBTRUNGMALOP
THISFORM.TXTMALOP.VALUE=""
THISFORM.TXTTENLOP.VALUE=""
THISFORM.TXTPHONGHOC.VALUE=""
ENDI
ENDI
THISFORM.REFRESH
CMDKETTHUC.CLICK
THISFORM.RELEASE
CMDXEMCSDL.CLICK
THISFORM.GRDLUOI.VISIBLE=.T.
THISFORM.REFRESH
Bài 6: Phép Tính 2 Số
CMDCONG.CLICK
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
THISFORM.TXTKQ.VALUE=STR(VAL(THISFORM.TXTSO1.VALUE)+VAL(THISFORM.TXT
SO2.VALUE))
THISFORM.REFRESH
CMDTRU.CLICK
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
THISFORM.TXTKQ.VALUE=STR(VAL(THISFORM.TXTSO1.VALUE)-
VAL(THISFORM.TXTSO2.VALUE))
THISFORM.REFRESH
CMDNHAN.CLICK
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
THISFORM.TXTKQ.VALUE=STR(VAL(THISFORM.TXTSO1.VALUE)*VAL(THISFORM.TXT
SO2.VALUE))
THISFORM.REFRESH
CMDCHIA.CLICK
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
IF VAL(THISFORM.TXTSO2.VALUE)<>0
IF MOD(VAL(THISFORM.TXTSO1.VALUE),VAL(THISFORM.TXTSO2.VALUE))<>0
THISFORM.TXTKQ.VALUE=STR(VAL(THISFORM.TXTSO1.VALUE)/VAL(THISFOR
M.TXTSO2.VALUE),5,1)
ELSE
THISFORM.TXTKQ.VALUE=STR(VAL(THISFORM.TXTSO1.VALUE)/VAL(THISFOR
M.TXTSO2.VALUE))
ENDIF
ELSE
THISFORM.TXTKQ.VALUE="KHONG DUOC"
ENDI
THISFORM.REFRESH
CMDXOA.CLICK
THISFORM.LBLKQ.VISIBLE=.F.
THISFORM.TXTKQ.VISIBLE=.F.
THISFORM.TXTSO1.VALUE=""
THISFORM.TXTSO2.VALUE=""
THISFORM.TXTKQ.VALUE=""
THISFORM.REFRESH
Bài 7: Tính Tổng n !
CMDTHUCHIEN.CLICK
N=VAL(THISFORM.TXTSO.VALUE)
IF N=0
S=1
ELSE
S=0
I=1
GT=1
DO WHILE I<=N
GT=GT*I
S=S+GT
I=I+1
ENDD
ENDI
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
THISFORM.TXTKQ.VALUE=STR(S)
CMDXOA.CLICK
THISFORM.TXTSO.VALUE=""
THISFORM.TXTKQ.VALUE=""
THISFORM.LBLKQ.VISIBLE=.F.
THISFORM.TXTKQ.VISIBLE=.F.
THISFORM.REFRESH
Bài 8: Tính Tổng n Số
CMDTHUCHIEN.CLICK
N=VAL(THISFORM.TXTSO.VALUE)
S=0
I=1
DO WHILE I<=N
S=S+I
I=I+1
ENDD
THISFORM.LBLKQ.VISIBLE=.T.
THISFORM.TXTKQ.VISIBLE=.T.
THISFORM.TXTKQ.VALUE=STR(S)
CMDXOA.CLICK
THISFORM.TXTSO.VALUE=""
THISFORM.TXTKQ.VALUE=""
THISFORM.LBLKQ.VISIBLE=.F.
THISFORM.TXTKQ.VISIBLE=.F.
THISFORM.REFRESH
Bạn đang đọc truyện trên: AzTruyen.Top