vfp:请问这个,退出表单运行代码怎么写
好吧,我知道了A=thisform.text1.valueifA<100quitelsethisform.text2.value=int(A/100)thisform.t...
好吧,我知道了
A=thisform.text1.value
if A<100
quit
else
thisform.text2.value=int(A/100)
thisform.text3.value=int(A%100/10)
thisform.text4.value=A%10
endif 展开
A=thisform.text1.value
if A<100
quit
else
thisform.text2.value=int(A/100)
thisform.text3.value=int(A%100/10)
thisform.text4.value=A%10
endif 展开
2个回答
展开全部
在表单的init事件里写:thisform.text1.value = “” &&初始化text1,让其输入的值为字符型
按钮事件:
cStr = alltirm(thisform.text1.value)
try
if val(cStr) < 100 &&将字符型转化成数值型并检测是否小于100
thisform.releas() &&小于100则退出表单
endif
CATCH &&如果字符包含了非法字符(val(cStr) 会抛出错误,则跳到此处)则退出表单
thisform.releas()
endtry
&&条件满足了赋值
with thisform
.textbox2.value = subst(cStr,1,1)
.textbox3.value = subst(cStr,2,1)
.textbox4.value = subst(cStr,3,1)
endwith
按钮事件:
cStr = alltirm(thisform.text1.value)
try
if val(cStr) < 100 &&将字符型转化成数值型并检测是否小于100
thisform.releas() &&小于100则退出表单
endif
CATCH &&如果字符包含了非法字符(val(cStr) 会抛出错误,则跳到此处)则退出表单
thisform.releas()
endtry
&&条件满足了赋值
with thisform
.textbox2.value = subst(cStr,1,1)
.textbox3.value = subst(cStr,2,1)
.textbox4.value = subst(cStr,3,1)
endwith
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询