Dim rom As New Random
Dim romcount As Integer
Dim str As String
Dim arr() As String
Dim int60, int70, int80, int90, int100, intx As Int32
ReDim arr(20)
For x As Integer = 0 To 19
romcount = rom.Next(0, 100)
arr(x) = romcount
Next
For x As Integer = 0 To 19
Application.DoEvents()
str &= ";" & CStr(arr(x))
intx = CInt(arr(x))
Application.DoEvents()
If 0 < intx And intx <= 59 Then
int60 += 1
ElseIf 60 <= intx And intx <= 69 Then
int70 += 1
ElseIf 70 <= intx And intx <= 79 Then
int80 += 1
ElseIf 80 <= intx And intx <= 89 Then
int90 += 1
ElseIf 90 <= intx And intx <= 100 Then
int100 += 1
End If
Next
Me.Label1.Text = str
Me.Label2.Text = "0-59人数为:" & int60 & Chr(10) & _
"60-69人数为:" & int70 & Chr(10) & _
"70-79人数为:" & int80 & Chr(10) & _
"80-89人数为:" & int90 & Chr(10) & _
"90-100人数为:" & int100 & Chr(10)
有时候自己动手学的更快