
vb的select语句问题、
PrivateSubCommand1_Click()DimaAsIntegerDimbAsIntegerText1.Text=aSelectCaseaCasea=1000...
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Text1.Text = a
Select Case a
Case a = 1000
Print "b = 10000"
Case a = 2000
Print "b = 20000"
Case a = 3000
Print "b = 30000"
Case Else
MsgBox "......"
End Select
End Sub只输出10000啊 展开
Dim a As Integer
Dim b As Integer
Text1.Text = a
Select Case a
Case a = 1000
Print "b = 10000"
Case a = 2000
Print "b = 20000"
Case a = 3000
Print "b = 30000"
Case Else
MsgBox "......"
End Select
End Sub只输出10000啊 展开
展开全部
一是Select Case语句语法错误,二是变量a的赋值来自Text1,而不是Text1的内容从变量a获得!(a的值只能恒为0了)
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = Text1.Text '变量a的值从Text1获取
Select Case a
Case 1000
Print "b = 10000"
Case 2000
Print "b = 20000"
Case 3000
Print "b = 30000"
Case Else
MsgBox "......"
End Select
End Sub
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = Text1.Text '变量a的值从Text1获取
Select Case a
Case 1000
Print "b = 10000"
Case 2000
Print "b = 20000"
Case 3000
Print "b = 30000"
Case Else
MsgBox "......"
End Select
End Sub
追问
这样改了,不管输入什么。都msgbox“。。。。。”
追答
看到这一句完全改变了左右两边!
a = Text1.Text '变量a的值从Text1获取
展开全部
函数语法错了,Case后面不用加变量,应该这样修改:
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Text1.Text = a
Select Case a
Case Is = 1000
Print "b = 10000"
Case Is = 2000
Print "b = 20000"
Case Is = 3000
Print "b = 30000"
Case Else
MsgBox "......"
End Select
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Text1.Text = a
Select Case a
Case Is = 1000
Print "b = 10000"
Case Is = 2000
Print "b = 20000"
Case Is = 3000
Print "b = 30000"
Case Else
MsgBox "......"
End Select
追问
不对,这样改好,不管输入什么。都msgbox“。。。。。”
追答
你的函数代入错了,是 a=Text1.Text ,VB是右边赋值给左边的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询