Vb.net 在vb中选择带有连接字符串的大小写
这是我的大学录取代码,但它不会运行Vb.net 在vb中选择带有连接字符串的大小写,vb.net,Vb.net,这是我的大学录取代码,但它不会运行 Public Class College_Admission Private Sub btnResult_Click(sender As Object, e As EventArgs) Handles btnResult.Click Dim score, rank As Integer score = txtScore.Text rank = txtRank.Text Select Case score And rank
Public Class College_Admission
Private Sub btnResult_Click(sender As Object, e As EventArgs) Handles btnResult.Click
Dim score, rank As Integer
score = txtScore.Text
rank = txtRank.Text
Select Case score And rank
Case Is >= 90 and >= 25
lblResult.Text = "Congratulation, you can apply for this college!"
Case Is >= 89 and >= 50
lblResult.Text = "Congratulation, you can apply for this college!"
Case Is >= 70 and >= 75
lblResult.Text = "Congratulation, you can apply for this college!"
Case Else
lblResult.Text = "Sorry, you can not apply this college."
End Select
End Sub
End Class
此代码有什么问题?不要为此使用Select。因为你有两个条件要检查,所以它不起作用。只要这样做:
If (score >= 90 And rank >= 25) Or (score >= 89 And rank >= 50) Or (score >= 70 And rank >= 75) Then
lblResult.Text = "Congratulations, you can apply to this college!"
Else
lblResult.Text = "Sorry, you cannot apply to this college."
End If
Select Case score And rank
我不确定语法是否是这样的。+1你赢了我:)我只是想知道你为什么说Select Case
在他目前的情况下不起作用。?它会起作用的。看看我下面的答案。是的,Select Case true
有点模糊,但Select x和y
没有。对于实际上只是if/else场景的情况,使用Select是没有意义的。谁否决了这一点<代码>不起作用显然是正确的:推送错误的语法。。。收到错误的答案If/Else
是最正确的。