I am trying to run a nested loop; it should call a result from a MDB database. Which it does, when I run the single loop it goes thru all of the entries. But when I try to get a number to display twice it stops on the second entry. Having it display the number twice is just a test to make sure it does work, I am going to modify it after I can prove the loop works. The count on the Message Box is correct, but the number displayed is wrong?
I want it to display each number twice and then move on to the next number.
Please see the code below.
Nested Loop Code:
Do Until number1 = 100 If number1 <= 0 Then Exit Do number1 -= 1 counter1 += 1 If intCurrentIndex < ds.Tables(0).Rows.Count - 1 Then intCurrentIndex = intCurrentIndex + 1 Do Until number2 = 10 If number2 <= 0 Then Exit Do number2 -= 1 counter2 += 1 txtResults.Text = ds.Tables(0).Rows(intCurrentIndex).Item("Results").ToString() Loop End If Loop MsgBox("The loop ran " & counter1 * counter2 & " times.")
Any Ideas
Thanks
Art W.




Reply With Quote