looping unique value form array list looping unique value form array list 2009luca (Programmer) (OP) 30 Apr 15 20:49 I just have MyArray filled with: 1111 1111 2222 3333 3333 3333 ... Ecc. i need to looping a unique items form the array For example 1111 2222 3333 How to? RE: looping unique value form array list SkipVought (Programmer) 30 Apr 15 21:52 Hi, What have you tried? What results did your code yield? RE: looping unique value form array list guitarzan (Programmer) 1 May 15 01:26 One way is to use the Dictionary object. Loop through each array element, and use the Dictionary object's "Exists" method to only add unique values to the dictionary. Google will yield many samples. RE: looping unique value form array list SaltyTheFrog (Programmer) 1 May 15 10:26 You never answered my previous question... http://www.vbforums.com/showthread.php?794925-loop... RE: looping unique value form array list tedsmith (Programmer) 6 May 15 23:59 Create a database table (in memory) of the data as rows (many examples around) Use a query using FIRST OF in the query will yield only one instance of each number when you loop through the resulting query results. RE: looping unique value form array list strongm (MIS) 7 May 15 08:57 Ted, if you read the thread linked by SaltyTheFrog you'll find that the OP does indeed get their array from a recordset. It is currently unclear why they don't just do a SELECT DISTINCT RE: looping unique value form array list tedsmith (Programmer) 7 May 15 11:25 stromgm Because I answered the original question on this form that did not mention a recordset. I assumed he was wanting to find out how to do it with an array obtained by any method. It should have given him the clue that if he already had it from recordset, then just apply a different "SQL" to the one he has. RE: looping unique value form array list strongm (MIS) 7 May 15 11:40 >that did not mention a recordset Sometimes important to read the whole thread ... But if you were looking at it from the point of view of "how to do it with an array obtained by any method" I'm not sure that loading the ADO library just to eliminate duplicates is ideal. The dictionary solution mentioned by guitarzan would be my preferred approach - although I'd be tempted to stick with VB's built in Collection class instead. RE: looping unique value form array list tedsmith (Programmer) 7 May 15 12:17 Would this depend on the size of the file? I do use a recordset method I described to extract unique values from a CSV file about 20mb in size. It only take a few seconds with a recordset. I would think far faster than looping through the records. I also had not thought of using SELECT DISTINCT!