下面通過介紹Wrox United的工作原理給出了循環和測試的一個示例
(
(
(
Dim conn As New SqlConnection(ConfigurationManager
Dim cmd As New SqlCommand(
Dim rdr As SqlDataReader
Dim wins As Integer =
Dim losses As Integer =
Dim draws As Integer =
Dim goalsFor As Integer =
Dim goalsAgainst As Integer =
Dim winRatio As Integer
conn
rdr = cmd
While rdr
goalsFor += Convert
goalsAgainst += Convert
If goalsFor > goalsAgainst Then
wins +=
ElseIf goalsFor < goalsAgainst Then
losses +=
Else
draws +=
End If
End While
Label
Label
Label
Label
Label
If losses =
Label
Return
End If
winRatio = Convert
Select Case winRatio
Case
Label
Case Is <
Label
Case Is <
Label
Case Is <
Label
Case Else
Label
End Select
End Sub
End Class
[
From:http://tw.wingwit.com/Article/program/net/201311/14540.html