Updating Array Length While Looping ArrayOct 9, 2009
I am working on a code that should capture the color of a pixel in a bitmap and then check if the 8 surrounding pixels have the same color. If the checked surrounding pixel HAS NOT the same color it will be ignored, otherwise if it HAS the same color, it should check for its own 8 surrounding pixels and so on.
To do that, I have created an array that starts with a single entry (the x,y coordinates of the initial pixel). So, when a pixel with the same color is found it is pushed to the end of the array. I used a for each loop supposing that VB would keep looping until the end of my array - and since it is growing, the last position of the array would be always pushed until I have not more pixels to be checked.
The problem is that VB is not respecting it, and is considering my array as if it had just 1 entry. Seems that it catch the size of the array when it enters the loop, and regardless the fact I have pushed new items to the array it doesnt keep looping it.
How can I force VB to update the end of array position while looping it? Although I think it wouldnt be necessary, here it goes the code I have so far...