原码如下:
Dim fuhao, answer
Private Sub Command1_Click()Select Case fuhaoCase "+"
answer = Text1.Text + Text2.Text
Case "-"
answer = Text1.Text - Text2.Text
Case "*"
answer = Text1.Text * Text2.Text
Case "/"
answer = Text1.Text / Text2.Text
End Select
Text3.Text = answer
End SubPrivate Sub Command2_Click()
Unload Me
End SubPrivate Sub Option1_Click()
fuhao = "+"
End SubPrivate Sub Option2_Click()
fuhao = "-"End SubPrivate Sub Option3_Click()
fuhao = "*"
End SubPrivate Sub Option4_Click()
fuhao = "/"
End Sub
除了+法外,其他正确输入看上去没有问题.
但加法返回错误值:
如输入:
1
2
得到12.
请问是怎么回事情.谢谢解答
Dim fuhao, answer
Private Sub Command1_Click()Select Case fuhaoCase "+"
answer = Text1.Text + Text2.Text
Case "-"
answer = Text1.Text - Text2.Text
Case "*"
answer = Text1.Text * Text2.Text
Case "/"
answer = Text1.Text / Text2.Text
End Select
Text3.Text = answer
End SubPrivate Sub Command2_Click()
Unload Me
End SubPrivate Sub Option1_Click()
fuhao = "+"
End SubPrivate Sub Option2_Click()
fuhao = "-"End SubPrivate Sub Option3_Click()
fuhao = "*"
End SubPrivate Sub Option4_Click()
fuhao = "/"
End Sub
除了+法外,其他正确输入看上去没有问题.
但加法返回错误值:
如输入:
1
2
得到12.
请问是怎么回事情.谢谢解答
解决方案 »
- 怎么让listview 选中行的内容,挨个写进数组。
- vb中将二进制转换为汉字
- 求教win2000下的ADSL拨号
- 关于MS Agent控件的问题
- [求代码]网络上TXT文本的读写问题
- mscomm在运行过程中,运行1小时后,没有响应,是硬件问题吗(单片机的问题??)
- 快过来看啊!! 100分啊(不够再加)!!! 在线等!!!
- 再問800*600下設計的圖片(.BMP,.JPG)如何在其它分辯率下滿屏顯示????
- 所有 VB 斑竹均无权封帐号,我[playyuer]从来就不删帖,其他斑竹也不会无缘无故删帖,删掉的贴子也多半有问题!
- 救命:true dbgrid 问题
- dll文件调用问题
- 带返回数值的函数不能return
answer = val(Text1.Text) + val(Text2.Text)修改下这个语句+ 符号左右均为字符串时,为连接操作,而非加法操作
如果我想在除数为0时报错"除数不能为0",那我该怎么改呢??
恭候解答:
if Text2.Text="0" then msgbox"不能为0":exit sub
answer = Text1.Text / Text2.Text