Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Chris

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...