if (text1 = " ") then '如果未输入值,提示错误 text3 = "please input number! " text1.setfocus else sum = 0: temp = text1 for a = 1 to temp sum = sum + a next a end if text2 = sum end sub
private sub command2_click() text1 = " ": text3 = " " '重新输入数据 text1.setfocus end sub
private sub command3_click() text1 = " ": text2 = " ": text3 = " " end sub
private sub command4_click() unload me end sub private sub text1_keypress(keyascii as integer) if (text1 < "48 ") or (text1 > "57 ") then text3 = "please input integer! " '有问题 end if end sub
private sub text2_keypress(keyascii as integer) text1.setfocus end sub
发表于:2007-06-14 09:22:221楼 得分:10
private sub text1_keypress(keyascii as integer) if (keyascii < 48) or (keyascii > 57) then text3 = "please input integer! " '有问题 end if end sub
发表于:2007-06-14 09:26:022楼 得分:0
it is a mess code! text1是字符串,temp也是,不是integer !!!! "57 " and "48 " 是字符串!!! (text1 < "48 ") or (text1 > "57 ") '????
sum = 0: temp = text1 for a = 1 to temp 'temp是字符串 sum = sum + a next a