wildfire1982 Posted November 18, 2003 Posted November 18, 2003 Hello folks, Its morning here and im havin troubles finding a very small bug in a very small loop. Sorry to have to ask you this but i cant seem to find it for some strange reason so could someone please let me know where i am being stupid. Thanks very much. The following loop works but only checks the first and last of the values. I.e. if numIngreds =5 then only the first and fifth elements of the array will be checked, missing the ones in the middle. Im sure its just me being stupid but i really cant see it. For counters = 1 To Module1.numIngreds + 1 Dim testVar As String = Module1.ingredientsList(1, counters) If Module1.ingredientsList.GetValue(1, counters) = "" Or Module1.ingredientsList.GetValue(1, counters) = Nothing Then Module1.ingredientsList(1, counters) = Module1.ingredientsList.GetValue(1, counters + 1) Module1.ingredientsList(2, counters) = Module1.ingredientsList.GetValue(2, counters + 1) counters2 = counters2 + 1 MessageBox.Show("its realised that there is a gap and so has tried to move it all") End If counters = counters + 1 Next Cheers guys and gals. Quote Chris
techmanbd Posted November 18, 2003 Posted November 18, 2003 Take out the counters = counters + 1. The FOR NEXT LOOP already does the count up for you Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
wildfire1982 Posted November 19, 2003 Author Posted November 19, 2003 Thanks for that, i had figured it out yesterday but someone keeps deleting my posts again. Cheers Quote Chris
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.