数字计算完以后,在点1的按钮,就接着连着计算后的数!这怎么解决啊!? 以下是我部分代码 dim a as integer dim b as integer dim c as string dim x as integer
private sub a0_click(index as integer) if x = 1 then text1.text = "0" if text1.text = "" then text1.text = text1.text & "0" exit sub end if end if text1.text = text1.text & "0" end sub
private sub a1_click(index as integer) if x = 1 then text1.text = "" end if if x = 1 and text1.text = "" then text1.text = text1.text & "1" end if text1.text = text1.text & "1" end sub
private sub a2_click(index as integer) if x = 1 then text1.text = "2" end if if text1.text <> "" then text1.text = " " text1.text = text1.text & "2" end if
text1.text = text1.text & "2" end sub
private sub a3_click(index as integer) x = true text1.text = text1.text & "3" end sub
private sub a4_click(index as integer) text1.text = text1.text & "4" end sub
private sub a5_click(index as integer)
text1.text = text1.text & "5" end sub
private sub a6_click(index as integer)
text1.text = text1.text & "6" end sub
private sub a7_click(index as integer)
text1.text = text1.text & "7" end sub
private sub a8_click(index as integer)
text1.text = text1.text & "8" end sub
private sub a9_click(index as integer)
text1.text = text1.text & "9" end sub
private sub b1_click(index as integer) a = val(text1.text) b = 1 text1.text = "" end sub
private sub b2_click(index as integer) a = val(text1.text) b = 2 text1.text = ""
end sub
private sub b3_click(index as integer) a = val(text1.text) b = 3 text1.text = "" end sub
private sub b4_click(index as integer) a = val(text1.text) b = 4 text1.text = "" end sub
private sub b5_click() select case b case 1 c = str(a + val(text1.text)) x = 1 case 2 c = str(a - val(text1.text)) case 3 c = str(a * val(text1.text)) case 4 if text1.text = "0" then msgbox "除数不能为零!" else text1.text = str(a / val(text1.text)) end if case else text1.text = "" end select text1.text = c end sub
private sub return_click(index as integer) text1.text = "0" end sub
private sub start_click(index as integer) end end sub
private sub text1_change() text1.text = val(text1.text)
privatesub command1_click()
if option1 then text3 = val(text1) + val(text2)
if option2 then text3 = val(text1) - val(text2)
if option3 then text3 = val(text1) * val(text2)
if option4 and val(text2) <>0then text3 = val(text1) / val(text2)
end sub