vfp程序改错题!该表单设计成一个登陆界面,其上有2个标签控件、2个文本框、1个命令按钮,当输入用户名(设置为hxhy)

问题描述:

vfp程序改错题!
该表单设计成一个登陆界面,其上有2个标签控件、2个文本框、1个命令按钮,当输入用户名(设置为hxhy)和密码(设置为5921)后,单击“确认”按钮,检验输入是否正确,如果正确,就显示“welcome.";如果不正确,则显示“用户名或密码不对,请重新输入”;若两次熟如不正确,则显示“用户名或密码不对,登录失败”.要求:
1、新建表单属性num,用于记录本次登录的次数,默认值设置为0;设置文本框Text2的Inputmask属性和PasswordChar属性.
2、在已编写的Command1的Click事件代码中有2个错误,请调试改正,调试改正中不得增删语句.
程序如下:
if thisform.text1.text="hxhy"and thisform.text2.text="5921"then
thisform.caption="welcome."
else
thisform.caption="用户名或密码不对,请重新输入"
thisform.num=thisform.num+2
endif
if thisform.num=5 then
thisform.caption="用户名或密码不对,登录失败"
thisform.release
endif
1个回答 分类:综合 2014-11-01

问题解答:

我来补答
if thisform.text1.text="hxhy"and thisform.text2.text="5921"then
thisform.caption="welcome." &&当正确输入用户名(hxhy)和密码(5921)后,显示welcome
else
thisform.caption="用户名或密码不对,请重新输入" &&不正确,则显示“用户名或密码不对,请重新输入”
thisform.num=thisform.num+2 &&该代码是用来记录输入错误次数的,应为thisform.num=thisform.num+1
endif
if thisform.num=5 then
thisform.caption="用户名或密码不对,登录失败"
thisform.release && 超过num次则关闭表单
endif
经上述分析:第五行应该为thisform.num=thisform.num+1
第七行应该为:if thisform.num=2then
 
 
展开全文阅读
剩余:2000
上一页:圆向量