首记录,前翻,后翻,末记录,后退x=this.value
select 学生
do case
case x=1
go top
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.t.
case x=2
skip -1
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.t.
if bof()
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.f.
endif
case x=3
skip
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.t.
if eof()
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.f.
endif
case x=4
go bottom
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.f.
case x=5
thisform.release
endcase
Thisform.refresh
口令:确定
locate for allt(学号)=allt(thisform.text1.value) if !Found()
messagebox("错误!")
else
messagebox("正确!")
endif
计时器1开始计时,逐秒增加的表单的init事件
thisform.s=0
thisform.cs="00"
thisform.f=0
thisform.cf="00"
thisform.m=0
thisform.cm="00"
thisform.text1.value=thisform.cs+":"+thisform.cf+":"+thi sform.cm
thisform.timer1.enabled=.f.
thisform.refresh
2日期时钟表单timer
d=datetime()
*日期时间型函数中分别取年月日后转字符型去空格放入text1中
cd=allt(str(year(d)))+"年"+allt(str(month(d)))+"月"+allt(str(day(d)))+"日"
thisform.text1.value=cd
*日期时间型函数中分别取小时分秒转字符型,若是个位数,则前面加零,放入text2中
h=hour(d)
ch=iif(h<10,"0"+allt(str(h)),allt(str(h)))
m=minute(d)
cm=iif(m<10,"0"+allt(str(m)),allt(str(m)))
s=sec(d)
cs=iif(s<10,"0"+allt(str(s)),allt(str(s)))
ct=ch+":"+cm+":"+cs
thisform.text2.value=ct
thisform.refresh
查询并显示学生的平均成绩
Combo1的valid事件
s=0
i=0
select 成绩
scan for 学号=学生.学号
s=s+成绩
i=i+1
endscan
av=s/i
thisform.text1.value=av
若是班级的平均成绩则将scan for 学号=学生.学号改为scan for left(allt(学号),3)=https://www.doczj.com/doc/d97108276.html,bo1.value 并在form中init中加入代码
set order to bj
bj=left(allt(学号),3)
https://www.doczj.com/doc/d97108276.html,bo1.additem(bj)
scan
if left(allt(学号),3)!=bj
bj=left(allt(学号),3)
https://www.doczj.com/doc/d97108276.html,bo1.additem(bj)
endif
endscan
Thisform.refresh
查询并显示学生的奖学金
Form代码同上
Combo1的valid代码
s=0
scan for left(allt(学号),3)=https://www.doczj.com/doc/d97108276.html,bo1.value s=s+奖学金
endscan
thisform.text1.value=s
Thisform.refresh
学籍信息查询1,一张表的
Pageframe1的click代码
do case
case this.activepage=1
this.page2.enabled=.f.
this.page3.enabled=.f.
thisform.refresh
case this.activepage=2
this.page1.enabled=.f.
this.page3.enabled=.f.
thisform.refresh
case this.activepage=3
this.page1.enabled=.f.
this.page2.enabled=.f.
thisform.refresh
endcase
Form的click代码
this.pageframe1.page1.enabled=.t.
this.pageframe1.page2.enabled=.t.
this.pageframe1.page3.enabled=.t.
2,三张表3,一个列表框加标签和文本框Form1的init代码
*以成绩表为主表分别与学生表和课程表建临时关联sele 学生
index on 学号tag 学号
set order to 学号
sele 成绩
set relation to 学号into 学生
sele 课程
index on 课程号tag 课程号
set order to 课程号
sele 成绩
*选项ADDITIVE作用是建立新的关联时保持原先的关联,否则会去掉原先的关联。
set relation to 课程号into 课程additive
Thisform.refresh
4,二个列表框
List1的interactivechange代码
thisform.list2.clear
sele 成绩
scan for 学号=学生.学号
thisform.list2.additem(ALLT(课程.课程名)+" "+str(成绩,6,2))
endscan
thisform.refresh
Form1的init代码
thisform.list2.clear
sele 成绩
scan for 学号=学生.学号
thisform.list2.additem(ALLT(课程.课程名)+" "+str(成绩,6,2))
endscan
Thisform.refresh
5两个列表框加上一张表
List2的interactivechange代码
*最好在成绩表结构中先建课程号的索引,不用INDEX 命令创建,否则会出现索引文件已存在的提示
set relation to
sele 成绩
index on 课程号tag 课程号
set order to 课程号
sele 课程
set relation to 课程号into 成绩addi
6有页框
Form代码
sele 学生
index on 学号tag 学号
set order to 学号
sele 成绩
set relation to 学号into 学生
sele 课程
index on 课程号tag 课程号
set order to 课程号
sele 成绩
*选项ADDITIVE作用是建立新的关联时保持原先的关联,否则会去掉原先的关联。
set relation to 课程号into 课程additive
Thisform.refresh
表头,前翻等命令按钮组的click代码
case x=2
skip -1
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.t.
if bof()
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.f.
endif
case x=3
skip
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.t.
if eof()
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.f.
endif
case x=4
go bottom
https://www.doczj.com/doc/d97108276.html,mand1.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand2.enabled=.t.
https://www.doczj.com/doc/d97108276.html,mand3.enabled=.f.
https://www.doczj.com/doc/d97108276.html,mand4.enabled=.f.
case x=5
thisform.release
endcase
thisform.pageframe1.page1.refresh
thisform.pageframe1.page2.refresh
7按钮组加表单
Option,,,的click代码
x=this.value
do case
case x=1
thisform.pageframe1.page1.enabled=.t.
thisform.pageframe1.page2.enabled=.f.
thisform.pageframe1.page3.enabled=.f.
thisform.pageframe1.activepage=1
thisform.refresh
case x=2
thisform.pageframe1.page1.enabled=.f.
thisform.pageframe1.page2.enabled=.t.
thisform.pageframe1.page3.enabled=.f.
thisform.pageframe1.activepage=2
thisform.refresh
case x=3
thisform.pageframe1.page1.enabled=.f.
thisform.pageframe1.page2.enabled=.f.
thisform.pageframe1.page3.enabled=.t.
thisform.pageframe1.activepage=3
thisform.refresh
Endcase
Form代码
thisform.pageframe1.page2.enabled=.f. thisform.pageframe1.page3.enabled=.f. thisform.refresh
学生表信息查询:1全是标签和文本框Form代码
this.lbl姓名.visible=.f.
this.txt姓名.visible=.f.
https://www.doczj.com/doc/d97108276.html,bel1.visible=.f.
this.text1.visible=.f.
this.lbl出生年月.visible=.f.
this.txt出生年月.visible=.f.
this.lbl奖学金.visible=.f.
this.txt奖学金.visible=.f.
thisform.text3.visible=.f.
Thisform.refresh
2,一个列表框/编辑框加标签和文本框Form的init和list1的click代码都是IF 性别
thisform.text1.value="T"
else
thisform.text1.value="F"
endif
Thisform.refresh
指定表文件的字段列表
Text1的valid事件
f=allt(thisform.text1.value)+".DBF"
if file(f)
thisform.list1.rowsourcetype=8
thisform.list1.rowsource=f
https://www.doczj.com/doc/d97108276.html,bel2.visible=.t.
thisform.list1.visible=.t.
else
messagebox("您所指定的表文件并不存在!",64,"表文件存在判断")
endif
Thisform.refresh
Text1的gotfocus事件
thisform.text1.value=""
https://www.doczj.com/doc/d97108276.html,bel2.visible=.f.
thisform.list1.visible=.f.
thisform.refresh
Form1的事件thisform.text1.gotfocus
关于文件类型
Option,,的click
x=this.value
do case
case x=1
create
case x=2
create form
case x=3
modify command
endcase
Thisform.refresh
学生成绩信息查询form代码
sele 成绩
index on 学号tag 学号
set order to 学号
sele 学生
set relation to 学号into 成绩
Thisform.refresh
l ist2的interactivechange
sele 学生
set order to tag 学号
sele 成绩
set relation to 学号into 学生
thisform.list3.clear
scan for 课程号=课程.课程号
thisform.list3.additem(allt(学生.姓名)+str(成绩.成绩,5)) endscan
Thisform.refresh
数据转移操作
Form代码
thisform.list1.clear
thisform.list2.clear
for i=1 to fcount()
thisform.list1.additem(field(i))
endfor
This.refresh
选择一项的click代码
thisform.list2.additem(thisform.list1.value)
thisform.list1.removeitem(thisform.list1.listindex) Thisform.refresh
选择全部的代码
for i=1 to thisform.list1.listcount
thisform.list2.additem(thisform.list1.list(i))
endfor
thisform.list1.clear
thisform.refresh
退还一项
*与选择一项代码完全相同,只是list1与list2交换thisform.list1.additem(thisform.list2.value)
thisform.list2.removeitem(thisform.list2.listindex) Thisform.refresh
抽奖表单
开始的click
thisform.timer1.enabled=.t.
thisform.text1.forecolor=rgb(0,0,0)
Thisform.refresh
抽号的click
thisform.timer1.enabled=.f.
thisform.text1.forecolor=rgb(255,255,255)
dele
Thisform.refresh
Timer事件
if !eof()
skip
else
go top
endif
thisform.text1.value=学号
thisform.refresh
三角形边长
判断计算的click事件
a=thisform.text1.value
b=thisform.text2.value
c=thisform.text3.value
if a+b>c and abs(a-b)
l=(a+b+c)/2
S=sqrt(l*(l-a)*(l-b)*(l-c))
if a*a+b*b=c*c
https://www.doczj.com/doc/d97108276.html,bel2.caption="能构成直角三角形,面积等于:"+allt(str(s))
else
https://www.doczj.com/doc/d97108276.html,bel2.caption="能构成三角形,面积等于:"+allt(str(s))
endif
else
if b+c>a and abs(b-c)0
l=(a+b+c)/2
S=sqrt(l*(l-a)*(l-b)*(l-c))
if b*b+c*c=a*a
https://www.doczj.com/doc/d97108276.html,bel2.caption="能构成直角三角形,面积等于:"+allt(str(s))
else
https://www.doczj.com/doc/d97108276.html,bel2.caption="能构成三角形,面积等于:"+allt(str(s))
endif
else
if a+c>b and abs(a-c)0
l=(a+b+c)/2
S=sqrt(l*(l-a)*(l-b)*(l-c))
if a*a+c*c=b*b
https://www.doczj.com/doc/d97108276.html,bel2.caption="能构成直角三角
形,面积等于:"+allt(str(s))
else
https://www.doczj.com/doc/d97108276.html,bel2.caption="能构成三角形,面积等于:"+allt(str(s))
endif
else
https://www.doczj.com/doc/d97108276.html,bel2.caption="不能构成三角形"
endif
endif
endif
thisform.refresh
计算圆周率
Ccommand的click
n=thisform.text1.value
thisform.text2.value=str(pi(),n+2,n)
Thisform.refresh
输入开始值
List1的valid事件
s=0
n=thisform.text1.value
a=(int((n-1)/3)+1)*3
for i=1 to 20
do while .t.
if mod(a,10)=3
thisform.list1.additem(allt(str(a)))
s=s+a
a=a+3
exit
endif
a=a+3
enddo
endfor
thisform.refresh
统计的click事件
https://www.doczj.com/doc/d97108276.html,bel2.caption="这组数字的和="+allt(str(s)) https://www.doczj.com/doc/d97108276.html,bel2.visible=.t.
thisform.refresh
>的click事件
thisform.list2.additem(thisform.list1.value)
thisform.refresh
删除的click
thisform.list2.removeitem(thisform.list2.listindex) Thisform.refresh
清空的click
thisform.list2.clear
Thisform.refres
Form的click
for i=1 to reccount()
thisform.list1.additem(姓名)
skip
endfor
Thisform.refresh
请输入一个金额
统计的click
store 0 to boys,grils
scan for gz>=thisform.text1.value
if xb="男"
boys=boys+1
else
grils=grils+1
endif
endscan
https://www.doczj.com/doc/d97108276.html,bel2.caption="工资超过"+allt(str(thisform.text1.value))+"元的男职工人数为:"+allt(str(boys))
https://www.doczj.com/doc/d97108276.html,bel3.caption="工资超过"+allt(str(thisform.text1.value))+"元的女职工人数为:"+allt(str(grils))
https://www.doczj.com/doc/d97108276.html,bel2.visible=.t.
https://www.doczj.com/doc/d97108276.html,bel3.visible=.t.
thisform.refresh
付费金额
开始的click
public t1
t1=time()
https://www.doczj.com/doc/d97108276.html,bel4.caption=t1
https://www.doczj.com/doc/d97108276.html,bel4.visible=.t.
Thisform.refresh
收费的clivk
t2=time()
s=(val(substr(t2,1,2))-val(substr(t1,1,2)))*3600
f=(val(substr(t2,4,2))-val(substr(t1,4,2)))*60
m=val(substr(t2,7,2))-val(substr(t1,7,2))
https://www.doczj.com/doc/d97108276.html,bel5.caption=t2
https://www.doczj.com/doc/d97108276.html,bel5.visible=.t.
t=(s+f+m)/60+1
https://www.doczj.com/doc/d97108276.html,bel6.caption=str(t)
https://www.doczj.com/doc/d97108276.html,bel6.visible=.t.
https://www.doczj.com/doc/d97108276.html,bel8.caption=allt(str(int(t*0.3*10)/10,5,1))+"元"
https://www.doczj.com/doc/d97108276.html,bel8.visible=.t.
Thisform.refresh
考试时间总共90分钟
显示剩余时间的click
https://www.doczj.com/doc/d97108276.html,bel4.caption="剩余时间为:"+allt(str(int(i/60)))+"分钟"
https://www.doczj.com/doc/d97108276.html,bel4.visible=.t.
thisform.refresh
清除的click
https://www.doczj.com/doc/d97108276.html,bel4.visible=.f.
Thisform.refresh
Timerr事件
i=i-1
thisform.text2.value=time()
Thisform.refresh
温度
华氏:text1的valid
cs=this.value
hs=9*cs/5+32
h=(thisform.shape1.height)/2
if h>0
h2=h-h*(cs/100)
else
h2=h+h*(cs/100)
endif
thisform.text2.value=hs
thisform.shape2.height=h2
Thisform.refresh
摄氏:text2的valid
hs=this.value
cs=(hs-32)*5/9
h=(thisform.shape1.height)/2
if h>0
h2=h-h*(cs/100)
else
h2=h+h*(cs/100)
endif
thisform.text1.value=cs
thisform.shape2.height=h2
Thisform.refre
输入1~10之间的数字
Text1的gotfocue
this.selectonentry=.t.
Thisform.refresh
显示的click
n=thisform.text1.value
dime a(n,n)
s=""
a=1
for i=1 to n
a(i,i)=0
a(i,5-i+1)=0
endfor
for i=1 to n
for j=1 to n
s=s+str(a(i,j),3)
endfor
s=s+chr(13) &&大小循环之间s+chr(13)作用为输出换行
endfor
thisform.edit1.value=s
thisform.refresh