-1

这是我关于大学录取的代码,但它不会运行。

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

这段代码有什么问题?

4

1 回答 1

2

不要为此使用 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
于 2013-11-10T07:34:46.177 回答