永发信息网

VB代码错了?

答案:3  悬赏:80  手机版
解决时间 2021-04-23 10:02
  • 提问者网友:难遇难求
  • 2021-04-22 18:26

Dim str1 As String
Dim str2 As String
Dim x As String

Private Sub Command1_Click()
Text1.Text = Text1.Text + "3"
End Sub

Private Sub Command10_Click()
x = "*"
str1 = Text1.Text
Text1.Text = ""
End Sub

Private Sub Command11_Click()
Text1.Text = Text1.Text + "7"
End Sub

Private Sub Command12_Click()
Text1.Text = Text1.Text + "8"
End Sub

Private Sub Command13_Click()
Text1.Text = Text1.Text + "."
End Sub

Private Sub Command14_Click()
Text1.Text = Text1.Text + "0"
End Sub

Private Sub Command15_Click()
str2 = Text1.Text
Select Case x
Case "+"
Text1.Text = Val(str1) + Val(sre2)
Case "-"
Text1.Text = Val(str1) - Val(sre2)
Case "*"
Text1.Text = Val(str1) * Val(sre2)
Case "/"
Text1.Text = Val(str1) / Val(sre2)
End Select

End Sub

Private Sub Command16_Click()
x = "/"
str1 = Text1.Text
Text1.Text = ""
End Sub

Private Sub Command17_Click()
Text1.Text = ""
End Sub

Private Sub Command2_Click()
Text1.Text = Text1.Text + "1"
End Sub

Private Sub Command3_Click()
Text1.Text = Text1.Text + "2"
End Sub

Private Sub Command4_Click()
x = "+"
str1 = Text1.Text
Text1.Text = ""
End Sub

Private Sub Command5_Click()
x = "-"
str1 = Text1.Text
Text1.Text = ""
End Sub

Private Sub Command6_Click()
Text1.Text = Text1.Text + "9"
End Sub

Private Sub Command7_Click()
Text1.Text = Text1.Text + "4"
End Sub

Private Sub Command8_Click()
Text1.Text = Text1.Text + "5"
End Sub

Private Sub Command9_Click()
Text1.Text = Text1.Text + "6"
End Sub

最佳答案
  • 五星知识达人网友:上分大魔王
  • 2021-04-22 20:05

把Val(sre2)改为Val(str2),还有以后写程序把每条写清楚些,都是开头对齐的,让别人看的很累的



全部回答
  • 1楼网友:时间的尘埃
  • 2021-04-22 22:35
--> Text1.Text = Val(str1) + Val(sre2) 把sre2改成str2
  • 2楼网友:老鼠爱大米
  • 2021-04-22 20:57

你还真够意思的,还拿来问了呢。。。。呵呵

提问问题记得把问题描述清楚,不然人家也不会知道你要问的是什么

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯