You should use a while loop because this is not possible (to my knowledge) in a for loop:
VB.NET:
Dim i as integer = 0
While i < StudentList.Items.Count - 1
If Ready = True Then
i += 1
Else
'do nothing
End If
End While
Be careful because you could get stuck in an infinite loop if ready never gets set, but you could avoid this by using a try block and catching an arithmatic overflow exception which would eventually occur in i.
Please describe what you're actually trying to accomplish rather than how you're trying to accomplish it because "pausing a loop" is not something that you would ever do. ss7thirty's suggestion is definitely not something you should do. That is known as a "busy waiting" loop and it is something that should never be done.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.