文本框里面输入未打折之前的金额,标签上面显示打折后需要支付的金额
Private Sub Command1_Click()
dim intmount as single
intmount = text1.text
if intmount >200 or intmount = 200 then
if intmount >300 or intmount = 300 then
label1.caption = intmount * 0.6
else
label1.caption = intmount * 0.7
end if
else
label1.caption = intmount
end if
End Sub
简单的说可以这样实现:在命令按钮中写如下代码:
do case
case thisform.text1.value>=200.00 and thisform.text1.value<400
thisform.text2.value=round(thisform.text1.value*0.95,1)
case thisform.text1.value>=400.00 and thisform.text1.value<800
thisform.text2.value=round(thisform.text1.value*0.9,1)
case thisform.text1.value>=800.00
thisform.text2.value=round(thisform.text1.value*0.8,1)
otherwise
thisform.text2.value=round(thisform.text1.value,1)
endcase
thisform.refresh
此外,要注意设置文本框的取值范围,文本框要设置成数字输入格式。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)