Welcome Guest [Log In] [Register]
Welcome to VITINHTHANHSON. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Bài tập Tạo Menu; FoxPro
Topic Started: Jun 19 2006, 05:17 PM (765 Views)
Dinhvanquanglk
Member Avatar
Tổng thư ký
Administration
Quote:
 
Tạo môt tệp có tên: hshs.dbf
Có các thông tin sau:
Structure for database: C:\QUANG\HSHS.DBF
Number of data records:      8
Date of last update  : 06/16/06
Memo file block size  :      64
Code Page            : 10000
Field  Field Name  Type      Width    Dec    Index  Collate
    1  MAHS        Character      2                 
    2  MALOP      Character      2                 
    3  HOTEN      Character    25                 
    4  NGAYSINH Date            8                 
    5  NOISINH    Character    20                 
    6  TOAN        Numeric      4      1         
    7  LY            Numeric      4      1         
    8  HOA          Numeric      4      1         
    9  TB            Numeric      4      1         
  10  HOCLUC      Character    15                 
  11  HANHKIEM    Character    10                 
  12  LYLICH        Memo          10                 
** Total **                      109
*----------------------------------------------*
Dùng lệnh :
Modi comm baitap
set stat off
set talk off
set clock on
set date fren
SET SYSMENU off
clea
close all
*-------------------------------
defi menu main Mess 'Created by: Quang_tin4b - Email: dinhvanquanglk@yahoo.com'
*-------------------
defi pad cn of main prom '\<Cap Nhat'
defi pad tk of main prom '\<Tim Kiem'
defi pad tke of main prom 'Thong \<Ke'
defi pad ht of main prom '\<He Thong'
*-------------------
on pad cn of main acti popu cn1
on pad tk of main acti popu tk1
on pad tke of main acti popu tke1
on pad ht of main acti popu ht1
*-------------------------------
defi popu cn1 rela marg
defi bar 1 of cn1 prom '\<Nhap ho so hoc sinh'
defi bar 2 of cn1 prom '\<Sua ho so hoc sinh'
defi bar 3 of cn1 prom '\<Xoa ho so hoc sinh'
defi bar 4 of cn1 prom 'Xem danh \<sach hoc sinh'
*--------------------------------
defi popu tk1 rela marg
defi bar 1 of tk1 prom 'Tim theo t\<en '
defi bar 2 of tk1 prom 'Tim theo \<que'
*---------------------------------
defi popu tke1 rela marg
defi bar 1 of tke1 prom 'Sap xep theo hoc \<luc'
defi bar 2 of tke1 prom 'Thong ke theo l\<op'
defi bar 3 of tke1 prom 'Sap xep theo ma hoc sinh'
*--------------------------------------
defi popu ht1 rela marg
defi bar 1 of ht1 prom 'Ve \<FoxPro'
defi bar 2 of ht1 prom 'Ve \<Windows'
*-----------------------------------------
on sele popu all do xuly with bar(),popu()
*---------------------------------------
acti menu main
retu
*----------------------------------------
proc xuly
para stt, tpop
do case
case stt=1 and tpop='CN1'
  do nhap
case stt=2 and tpop='CN1'
  do sua
case stt=3 and tpop='CN1'
  do xoa
case stt=4 and tpop='CN1'
  do xem
case stt=1 and tpop='TK1'
  do tten
case stt=2 and tpop='TK1'
  do tque
case stt=1 and tpop='TKE1'
  do sxhl
case stt=2 and tpop='TKE1'
  do tklop
case stt=3 and tpop='TKE1'
  do sxhs
  case stt=1 and tpop='HT1'
  deac menu main
case stt=2 and tpop='HT1'
  quit
endcase
show menu main
retu
close all
clea
*-------------------------------
proce nhap
hide menu main
hide popu all
use hshs
appe
use
show menu main
retu
clea
*-----------------------------
proce sua
hide menu main
hide popu all
use hshs
brow all titl 'Chuong trinh sua danh sach hoc sinh'
use
show menu main
retu
clea
*-------------------------------
proce xoa
hide menu main
hide popu all
use hshs
@3,20 say'CHUONG TRINH XOA DU LIEU'
@4,15 SAY'*---------------------------------*'
@5,19 say 'Nhap ten cua hoc sinh: ' get ten defa spac(25)
read
loca for allt(uppe(ten))=allt(uppe(hoten))
if !found()
wait 'Khong tim thay hoc sinh nay!'
else
wait 'Da tin thay hoc sinh nay!'
tl=spac(1)
@9,5 say'Ban co thuc su muon xoa hoc sinh nay khong?(C/K) :' get tl pict'!' valid tl $'CK'
read
if allt(uppe(tl))='C'
dele for allt(uppe(ten))=allt(uppe(hoten))
pack
else
wait 'Hoc sinh nay khong duoc xoa '
brow all titl 'Danh sach hoc sinh sau khi xoa '
endif
endif
clea
* Modul hoi co lam tiep khong?
@ 10,5 say'Ban co tiep tuc nua khong?' get q defa spac(1) pict'!' valid q$'CK'
read
  if allt(uppe(q))='C'
  do tten
  clea
  else
  clea
  endi 
show menu main
clea
retu
*-----------------------------------
proc xem
hide menu main
hide popu all
use hshs
brow all titl 'Danh sach hoc sinh' noedit
use
show menu main
retur
*--------------------------------------
proce tten
hide menu main
hide popu all
use hshs
@3,20 say'CHUONG TRINH TIM KIEM'
@4,15 SAY'*---------------------------------*'
@5,19 say 'Nhap ten cua hoc sinh: ' get ten defa spac(25)
read
loca for allt(uppe(ten))=allt(uppe(hoten))
if !found()
wait 'Rat tiec!. Khong tim thay hoc sinh nay!' to x wind
else
wait 'Da tin thay hoc sinh nay!' to x wind
brow for allt(uppe(ten))=allt(uppe(hoten)) title 'Thong tin ve hoc sinh: '+ten noedit
endif
* Modul hoi co lam tiep khong?
@ 10,5 say'Ban co tiep tuc nua khong?' get q defa spac(1) pict'!' valid q$'CK'
read
  if allt(uppe(q))='C'
  do tten
  clea
  else
  clea
  endi 
show menu main
clea
retu
*----------------------------------------------------- 
proce tque
hide menu main
hide popu all
use hshs
@3,20 say'CHUONG TRINH TIM KIEM'
@4,15 SAY'*---------------------------------*'
@5,19 say 'Nhap vao mot tinh bat ky: ' get que defa spac(20)
read
loca for allt(uppe(que))=allt(uppe(noisinh))
if !found()
wait 'Rat tiec!. Khong tim thay ten tinh nay!' to x wind
else
wait 'Da tin thay ten tinh nay!' to x wind
brow for allt(uppe(que))=allt(uppe(noisinh)) title 'Danh sach nhung hoc sinh cung que'
endif
* Modul hoi co lam tiep khong?
@ 10,5 say'Ban co tiep tuc nua khong?' get q defa spac(1) pict'!' valid q$'CK'
read
if allt(uppe(q))='C'
do tque
clea
else
clea
endif
show menu main
retu 
*------------------------------------------
proce sxhl
hide popu all
hide menu main
use hshs
repl all tb with (toan+ly+hoa)/3
*----------------
repl all hocluc with iif(tb>=9,'Xuat sac',iif(tb>=8,'Gioi',iif(tb>=7,'Kha',;
iif(tb>=6,'TBK',iif(tb>=5,'TB','Yeu')))))
brow all titl ' Danh sach hoc luc cua hoc sinh' noedit
use
show menu main
*-------------------------------------
proce tklop
hide menu main
hide popu all
use hshs
@10,8 say'Moi ban nhap ma lop can xem: ' get lop defa spac(2) pict'!'
read
loca for allt(uppe(lop))=allt(uppe(malop))
if !found()
wait 'Rat tiec! Khong ton tai ma lop nay!' to x wind time 2
else
wait 'Co ton tai ma lop nay!' to x wind time 2
brow for allt(uppe(lop))=allt(uppe(malop)) titl 'Danh sach hoc sinh cua lop: '+lop  noedit
endi
clea
* Modul hoi co lam tiep khong?
@ 10,5 say'Ban co tiep tuc nua khong?' get q defa spac(1) pict'!' valid q$'CK'
read
if allt(uppe(q))='C'
do tklop
clea
else
clea
show menu main
endif
use
retu
*-----------------------
PROCEDURE sxhs
HIDE MENU main
HIDE POPUP all
USE hshs
INDEX ON mahs TO sxhs
SET INDEX TO sxhs
BROWSE all TITLE' Danh sach hoc sinh sau khi da duoc sap xep' noedit
USE
SHOW MENU main
RETURN
*=----------------------------
*--- The end ----*
[/color]
Posted Image

[size=5]Nhà 0 số-Mố Cầu Long Biên-Long Biên-Hà Nội[/size]
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Foxpro · Next Topic »
Add Reply