| 发表于:2007-07-25 19:05:10 楼主 |
所谓的连加 和 连乘其实就是和电脑计算器一样,当1+2后再按 "+ "号的时候text显示的是3,这就是我所谓的 连加 和连乘 . 由于我是vb 的新手,这个网站也是别人给推荐的,所以我刚刚注册,没有分数给大家,希望大家谅解. 以下是我的代码,我有家一个静态变量的想法,不知道对不对,希望大家多多指点,谢谢了.希望大家能帮我解决这个问题. private sub command1_click(index as integer) text1.text = text1.text + command1(index).caption end sub private sub command2_click(index as integer) text3.text = text3.text + command2(index).caption text2.text = text1.text text1.text = " " end sub private sub command3_click() select case text3.text case "+ " text1.text = val(text2.text) + val(text1.text) case "- " text1.text = val(text2.text) - val(text1.text) case "* " text1.text = val(text2.text) * val(text1.text) case "/ " text1.text = val(text2.text) / val(text1.text) case "x^2 " text1.text = val(text2.text) * val(text2.text) case "1/x " text1.text = "0 " & 1 / val(text2.text) case "sqr " text1.text = sqr(text2.text) case "% " text1.text = text2.text / 100 end select text3.text = " " end sub private sub command4_click() text1.text = " " text2.text = " " end sub private sub command5_click() dim numchar as integer numchar = len(text1.text) if numchar > 0 then text1.text = left$(text1.text, numchar - 1) end if end sub private sub form_load() form1.width = screen.width / 4 form1.height = screen.height / 5 * 3 form1.left = (screen.width - form1.width) / 2 form1.top = (screen.height - form1.height) / 2 end sub private sub text2_change() text2.text = text1.text end sub 我的qq505811721 如果要我的vb程序来指点请加我谢谢了,因为我不知道怎么上传附件,我是纯新手!!! |
|
|
|
|