帮我看下VB代码错在哪里

来源:百度知道 编辑:UC知道 时间:2024/05/13 10:42:17
Private Sub Combo1_Click()
If Combo1.Text = "Y型接线" Then
List1.Visible = True And List2.Visible = False
Else
If Combo1.Text = "△型接线" Then
List2.Visible = True And List1.Visible = False
End If
End If
End Sub


List1.Visible = True And List2.Visible = False
List2.Visible = True And List1.Visible = False
两句中的and 去掉按成回车

and 是逻辑运算符,不能用来连接两句程序语句

正确代码应该是这样:

Private Sub Combo1_Click()
If Combo1.Text = "Y型接线" Then
List1.Visible = True
List2.Visible = False
Else
If Combo1.Text = "△型接线" Then
List2.Visible = True
List1.Visible = False
End If
End If
End Sub

正确代码

Private Sub Combo1_Click()
If Combo1.Text = \"Y型接线\" Then
List1.Visible = True
List2.Visible = False
Else
If Combo1.Text = \"△型接线\" Then
List2.Visible = True
List1.Visible = False
End If
End If
End Sub