如何用vb程序设计一个科学型计算器
答案:2 悬赏:50 手机版
解决时间 2021-02-06 08:11
- 提问者网友:爱了却不能说
- 2021-02-05 21:53
如何用vb程序设计一个科学型计算器
最佳答案
- 五星知识达人网友:几近狂妄
- 2021-02-05 23:18
打开VB编辑器界面,建立UserForm1添加好如图的控件改动好对应的Caption
加号按钮的程序代码
清除按钮的程序代码
退出按钮的程序代码
加号按钮的程序代码
清除按钮的程序代码
退出按钮的程序代码
全部回答
- 1楼网友:往事隔山水
- 2021-02-06 00:58
option explicit private sub command1_click() text1 = "" text2 = "" label5.caption = "" text1.setfocus option1.value = true end sub private sub command2_click() end end sub private sub command3_click() if option1.value = true then label5.caption = val(text1) + val(text2) end if if option2.value = true then label5.caption = val(text1) - val(text2) end if if option3.value = true then label5.caption = val(text1) * val(text2) end if if option4.value = true then label5.caption = val(text1) / val(text2) end if command1.setfocus end sub private sub text1_keypress(keyascii as integer) if keyascii = 13 then option1.setfocus end if if isnumeric(text1.text) then if (keyascii = 45) then option2.value = true text2.setfocus elseif (keyascii = 43) then option1.value = true text2.setfocus elseif (keyascii = 42) then option3.value = true text2.setfocus elseif (keyascii = 47) then option4.value = true text2.setfocus end if elseif (len(text1.text) > 0) then msgbox "你输入了不正确格式或字符,请重新输入(你只能输入 0--9十个数字)", vbokonly + vbinformation, "注意" text1.text = "" end if end sub private sub text2_keypress(keyascii as integer) if isnumeric(text2.text) then elseif (len(text2.text) > 0) then msgbox "你输入了不正确格式或字符,请重新输入(你只能输入 0--9十个数字)", vbokonly + vbinformation, "注意" text2.text = "" end if if keyascii = 13 then command3.setfocus end if end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯