我在这里给你举一个具体的例子吧,比如说是要注册用户吧,原来已有的用户就不能用了,这样的话我要检查一下,你输入的用户是不是存在.
if thisform.command1.caption="注册"
if empty(thisform.text1.value)
messagebox("用户名不能为空,请输入用户名!",48,"提示")
thisform.text1.value=""
thisform.text2.value=""
thisform.text1.setfocus
else
if empty(thisform.text2.value)
messagebox("密码不能为空,请输入密码!",48,"提示")
thisform.text2.value=""
thisform.text2.setfocus
else
use user123
locate for 用户名=alltrim(thisform.text1.value)
if found()
messagebox("该用户已存在,请用别的用户名!",48,"提示")
thisform.text1.value=""
thisform.text2.value=""
thisform.text1.setfocus
else
append blank
replace 用户名 with thisform.text1.value
replace 密码 with thisform.text2.value
messagebox("用户注册成功",48,"提示")
thisform.command1.caption="继续注册"
thisform.command2.caption="退出"
endif
use
endif
endif
else
thisform.text1.value=""
thisform.text2.value=""
thisform.text1.setfocus
thisform.command1.caption="注册"
thisform.command2.caption="取消"
endif
thisform.refresh