
05-23-2012, 11:27 AM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
|
snarfblam's suggestion is simplest, and probably the best way to go.
But you do have a chance to debug some logic here, so for fun, before you switch to the better method, you might want to practice some debugging.
Have you set a break point in the code and stepped through it to see what the values are as you add each name to the "list".
Just looking at the logic of the code, shows there are cases that will never be hit.
Can you answer the questions:
Q1. Which index of the array will be the first used, index 0 or index 3?
Q2. After the first file name is added, what are the values of the four array elements?
Q3. After the second file name is added, what are the values of the four array elements? (big clue to the logic error here)
Q4. Will the last three ElseIf condition blocks ever be entered?
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|