Reputation: 305
EDIT: I have a ItemList : Dim ItemList As New List(Of String) I wanna append each element from itemlist to a new list for 10 times each, then to start over again. How can I make a loop for each element while there are still elements in the list (10 times each)?
I tried this but it's not working. it's too complicated for me cause I'm a newbie
Private crt As Integer = 0
Private limit As Integer = 0
Private Function getline() As String
Dim line As String = ""
SyncLock addlines
Do While limit < 10
line = ItemList(crt)
limit += 1
Loop
limit = 0
crt += 1
End SyncLock
addlines.AppendText(Environment.NewLine & line & " limit:" & limit & " crt:" & crt)
'Return line
End Function
thanks
I have also tried this:
For Each I As Item In Items
If I = x Then Continue For
' Do something
Next
but I didn't know where to add the 10 times limit and also the current item number(crt)
Upvotes: 0
Views: 989
Reputation: 34917
As best I can make out of that mess of a question, you seem to want to append each line in ItemList (whatever that object is) 10 times.
This should do the trick.
Dim limit as integer=10
For each line as string in ItemList
For lineNum as integer = 1 to limit
addlines.AppendText(string.format("{0}{1} Limit: {2} CRT:{3}", Environment.NewLine, line, limit, lineNum ))
Next lineNum
Next line
Update: Updated answer for explanation in comments about what CRT was.
Upvotes: 1