level 1
xiya061
楼主
各位大虾,为啥我这段程序加了goto以后就是死循环了,没有用goto的时候可以执行啊,我看来看去都不知道错哪了,希望大虾们帮忙解决一下。
Private Sub Command2_Click()
Dim Sflag As Boolean
Randomize
List2.Clear
Dim lCount As Integer
lCount = List1.ListCount
ReDi***Count)
For i = 0 To UBound(s) - 1
Do
s(i) = Int(Rnd * lCount)
Sflag = False
For j = 0 To i - 1
If s(j) = s(i) Then
Sflag = True
End If
Next
If Sflag = False Then Exit Do
Loop
Next
l1: k = 0
For i = 0 To UBound(s) - 1
k = k + List1.List(s(i))
If k > Text2.Text And k < Text1.Text Then
GoTo l1
Else
List2.AddItem List1.List(s(i))
End If
Next
End Sub
2011年03月30日 03点03分
1
Private Sub Command2_Click()
Dim Sflag As Boolean
Randomize
List2.Clear
Dim lCount As Integer
lCount = List1.ListCount
ReDi***Count)
For i = 0 To UBound(s) - 1
Do
s(i) = Int(Rnd * lCount)
Sflag = False
For j = 0 To i - 1
If s(j) = s(i) Then
Sflag = True
End If
Next
If Sflag = False Then Exit Do
Loop
Next
l1: k = 0
For i = 0 To UBound(s) - 1
k = k + List1.List(s(i))
If k > Text2.Text And k < Text1.Text Then
GoTo l1
Else
List2.AddItem List1.List(s(i))
End If
Next
End Sub

