“在Text1和Text2中分别输入两个整数,单击"计算"按钮后,在Text3中显示两个整数之和。” 5
请问用vb怎么编写程序?这是我自己写的,请问有什么问题?PrivateSubCommand1_Click()DimxAsInteger,yAsIntegerIfIsNum...
请问用vb怎么编写程序?这是我自己写的,请问有什么问题?
Private Sub Command1_Click()
Dim x As Integer, y As Integer
If IsNumeric(Text1.Text) = Flase Or Text1.Text = "" Then Exit Sub
If IsNumeric(Text2.Text) = Flase Or Text2.Text = "" Then Exit Sub
x = (Text1.Text) + (Text2.Text)
Text3.Text = x
End Sub
谢谢!! 展开
Private Sub Command1_Click()
Dim x As Integer, y As Integer
If IsNumeric(Text1.Text) = Flase Or Text1.Text = "" Then Exit Sub
If IsNumeric(Text2.Text) = Flase Or Text2.Text = "" Then Exit Sub
x = (Text1.Text) + (Text2.Text)
Text3.Text = x
End Sub
谢谢!! 展开
展开全部
Private Sub Command1_Click()
Dim x As Integer, y As Integer
If IsNumeric(Text1.Text) = Flase Or Text1.Text = "" Then Exit Sub
If IsNumeric(Text2.Text) = Flase Or Text2.Text = "" Then Exit Sub
x = Val(Text1.Text) + Val(Text2.Text)
Text3.Text = x
End Sub
text属性是 字符串 就算你输入数字 也是字符串形式的数字 需要转换为数值型数据 才能四则运算
Dim x As Integer, y As Integer
If IsNumeric(Text1.Text) = Flase Or Text1.Text = "" Then Exit Sub
If IsNumeric(Text2.Text) = Flase Or Text2.Text = "" Then Exit Sub
x = Val(Text1.Text) + Val(Text2.Text)
Text3.Text = x
End Sub
text属性是 字符串 就算你输入数字 也是字符串形式的数字 需要转换为数值型数据 才能四则运算
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询