编程小问题 ......

来源:百度知道 编辑:UC知道 时间:2024/05/25 13:05:47
Private Sub Command1_Click()
Text3.Text = Text1.Text + Text2.Text
关于加法的..
做出来 12+12=1212 了 怎么办

text?.text的内容是个字符串,"+"运算是将两字符串连接起来,当然得到的"1212"
改作:
Text3.Text = val(Text1.Text) + Val(Text2.Text)

Private Sub Command1_Click()
Text3.Text = Str$(Val(Text2.Text) + Val(Text1.Text))
end sub

Text1和Text输出来的是字符型数字,你得用字符数值转换函数Val。
Text.Text=Val(Text1.Text)+Val(Text2.Text)