VFP表单制作编程语言汇总.docx
VFP表单制作 编程语言汇总最前一个: 后退: go top thisform.text1.value=用户名 thisform.text2.value=用户密码 thisform.refresh if not eof skip-1 thisform.text1.value=用户名 thisform.text2.value=用户密码 endif thisform.refresh 前进: if !bof skip thisform.text1.value=用户名 thisform.text2.value=用户密码 endif thisform.refresh 最后一个: go bottom thisform.text1.value=用户名 thisform.text2.value=用户密码 thisform.refresh 删除: delete thisform.refresh 退出: release thisform form1 :set dele on 修改与保存: if this.caption="修改" thisform.text1.enabled=.t. thisform.text2.enabled=.t. mand1.enabled=.f. mand2.enabled=.f. mand3.enabled=.f. mand4.enabled=.f. this.caption="保存" else sele 系统用户表 replace 用户名 with alltrim(thisform.text1.value),; 用户密码 with alltrim(thisform.text2.value) thisform.text1.enabled=.f. thisform.text2.enabled=.f. mand1.enabled=.t. mand2.enabled=.t. mand3.enabled=.t. mand4.enabled=.t. this.caption="修改" wait window "资料已保存!" timeout 1 endif thisform.refresh form1 输入代码确认: dm=thisform.text1.value S=val(subs(dm,1,1)*11+val(subs(dm,2,1)*9+val(subs(dm,3,1)*7+val(subs(dm,4,1)*5+val(subs(dm,5,1)*3 if mod(s,11)=val(subs(dm,6,1) thisform.text2.value= "输入代码正确!" else thisform.text2.value="输入代码错误!" endif form1 读者信息维护: if this.caption="修改" thisform.text1.enabled=.t. thisform.text2.enabled=.t. thisform.text3.enabled=.t. thisform.text4.enabled=.t. thisform.text5.enabled=.t. thisform.text6.enabled=.t. thisform.text7.enabled=.t. thisform.text8.enabled=.t. thisform.text9.enabled=.t. mand1.enabled=.f. mand2.enabled=.f. mand3.enabled=.f. mand4.enabled=.f. this.caption="保存" else sele 读者信息表 replace 读者编号 with alltrim(thisform.text1.value) replace 读者姓名 with alltrim(thisform.text2.value) replace 工作单位 with alltrim(thisform.text3.value) replace 家庭地址 with alltrim(thisform.text4.value) replace 电话号码 with alltrim(thisform.text5.value) replace 电子邮件地 with alltrim(thisform.text6.value) replace 登记日期 with thisform.text7.value replace 备注 with alltrim(thisform.text8.value) replace 读者性别 with alltrim(thisform.text9.value) thisform.text1.enabled=.f. thisform.text2.enabled=.f. thisform.text3.enabled=.f. thisform.text4.enabled=.f. thisform.text5.enabled=.f. thisform.text6.enabled=.f. thisform.text7.enabled=.f. thisform.text8.enabled=.f. thisform.text9.enabled=.f. mand1.enabled=.t. mand2.enabled=.t. mand3.enabled=.t. mand4.enabled=.t. this.caption="修改" wait window "资料已保存!" timeout 1 endif thisform.refresh (前一个后一个类似于最初,改每个value后面的字段名即可) combo1: LPARAMETERS cItem if this.caption="添 加" thisform.text1.enabled=.t. thisform.text2.enabled=.t. thisform.text3.enabled=.t. thisform.text4.enabled=.t. thisform.text5.enabled=.t. thisform.text6.enabled=.t. thisform.text7.enabled=.t. thisform.text8.enabled=.t. bo1.enabled=.t. thisform.text7.value=date this.caption="保 存" else sele 读者信息表 insert into 读者信息表(读者编号,读者姓名,读者性别,工作单位,家庭地址,电话号码,电子邮件地,登记日期,备注); values(alltrim(thisform.text1.value),alltrim(thisform.text2.value),bo1.value,alltrim(thisform.text3.value),; alltrim(thisform.text4.value),alltrim(thisform.text5.value),alltrim(thisform.text6.value),thisform.text7.value,alltrim(thisform.text8.value) thisform.text1.enabled=.f. thisform.text2.enabled=.f. thisform.text3.enabled=.f. thisform.text4.enabled=.f. thisform.text5.enabled=.f. thisform.text6.enabled=.f. thisform.text7.enabled=.f. thisform.text8.enabled=.f. bo1.enabled=.f. this.caption="添 加" wait window "资料已保存!" timeout 1 thisform.refresh endif form1 还书:sele 借阅信息表 replace 还书日期 with dtoc(date) sele 书籍信息表 replace 是否被借出 with "否" wait window "书籍成功归还!" timeout 2 thisform.refresh Text20: sele 借阅信息表 loca for 借阅编号=alltrim(this.value) thisform.text21.value=出借日期 thisform.text22.value=备注信息 thisform.text1.value=书籍编号 thisform.text10.value=读者编号 sele 书籍信息表 locate for 书籍编号=thisform.text1.value thisform.text2.value=书籍名称 thisform.text3.value=书籍作者 thisform.text4.value=出版社名称 thisform.text5.value=出版日期 thisform.text6.value=书籍页码 thisform.text7.value=关键词 thisform.text8.value=登记日期 thisform.text9.value=是否被借出 thisform.edit1.value=备注 sele 读者信息表 locate for 读者编号=thisform.text10.value thisform.text11.value=读者姓名 thisform.text13.value=工作单位 thisform.text14.value=家庭地址 thisform.text15.value=电话号码 thisform.text16.value=电子邮件地 thisform.text17.value=登记日期 thisform.text18.value=备注 thisform.text12.value=读者性别 thisform.refresh Form1:sele 借阅信息表 count to b thisform.text20.value=alltrim(str(b+1) thisform.text21.value=date Text1:sele 书籍信息表 locate for 书籍编号=alltrim(this.value) if !found wait window "您输入的书籍编号有误!" timeout 2 this.setfocus thisform.refresh else thisform.text2.value=书籍名称 thisform.text3.value=书籍作者 thisform.text4.value=出版社名称 thisform.text5.value=出版日期 thisform.text6.value=书籍页码 thisform.text7.value=关键词 thisform.text8.value=登记日期 thisform.text9.value=是否被借出 thisform.edit1.value=备注 thisform.refresh endif text10:sele 读者信息表 locate for 读者编号=alltrim(this.value) if !found wait window"您输入的读者编号有误!" timeout 2 this.setfocus thisform.refresh else thisform.text11.value=读者姓名 thisform.text13.value=工作单位 thisform.text14.value=家庭地址 thisform.text15.value=电话号码 thisform.text16.value=电子邮件地 thisform.text17.value=登记日期 thisform.text18.value=备注 thisform.text12.value=读者性别 sele 借阅信息表 count to a for 读者编号=alltrim(this.value) and 还书日期="" thisform.text19.value=str(a) thisform.refresh endif 书籍信息维护:,唯一不同:在thisform.text9.enabled=.f./.t. 后加一个thisform. edit1.enabled=.f./.t.,且replace 备注 with thisform.edit1.value combo1LPARAMETERS cItem 书籍信息添加:与读者信息添加类似,区别: 在上面中间alltrim处加comno1和edit1的,下面多一个thisform.edit1.enabled=.f. , if 用户密码=alltrim(thisform.text1.value) do 菜单.mpr release thisform else wait window "您输入的密码有误,请重新输入!" timeout 2 thisform.text1.value="" thisform.text1.setfocus thisform.refresh endif if this.caption="添 加" thisform.text1.enabled=.t. thisform.text2.enabled=.t. this.caption="保 存" else sele 系统用户表 insert into 系统用户表(用户名,用户密values(alltrim(thisform.text1.value),alltrim(thisform.text2.value) thisform.text1.enabled=.f. thisform.text2.enabled=.f. 码) this.caption="添 加" wait window "资料已保存!" timeout 1 thisform.refresh endif