Computing.Net > Forums > Programming > VB Array Problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB Array Problem

Reply to Message Icon

Name: quanta15
Date: March 28, 2003 at 08:37:45 Pacific
OS: NA
CPU/Ram: NA
Comment:

Does anyone know an efficient way to take out duplicate values in an array? I have a web page that queries a dtabase and get a long list of keywords to display in a . I don't want any duplicates, so maybe someone can help me out?



Sponsored Link
Ads by Google

Response Number 1
Name: Elric
Date: March 29, 2003 at 03:09:14 Pacific
Reply:

G'day

Try using a modified bubble sort (plenty of examples in this forum recently).
Instead of doing the
if n[j]]n[j+1]then swap

replace with
if n[j]=n[j+1] then do nothing
else n[j]=n[j+1]

You might have to fiddle with it a bit, but it should work (good idea to sort then too)
regards,
Elric


0

Response Number 2
Name: elric
Date: March 29, 2003 at 03:14:50 Pacific
Reply:

G'day,

I'm sorry about that: greater than doesn't work, so I use square bracket instead- now that doesn't work --- any ideas???????????

that first line should have read:

if n[j] is greater than n[j+1] then swap

those square brackets worked but the gtr than square bracket didn't???????????
hope I haven't confused you too much...
regards,
Elric


0

Response Number 3
Name: elric
Date: March 29, 2003 at 03:17:36 Pacific
Reply:

G'day,

OOps!!!!!! It did - my spacing I think.
Time to get my eyes tested I think.
Just ignore my rambling..
regards,
Elric


0

Response Number 4
Name: rasdub
Date: April 2, 2003 at 05:47:19 Pacific
Reply:

Why not clean the process at the beginning of the task? When you query the database, just use the DISTINCT keyword in your query (i.e., SELECT DISTINCT(LastName) FROM Employees). Then you will only get one occurrence of each returned value. Make sense?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB Array Problem

VB Arrays www.computing.net/answers/programming/vb-arrays/15454.html

PHP: File into array problem www.computing.net/answers/programming/php-file-into-array-problem/15399.html

Array Problem www.computing.net/answers/programming/array-problem/1568.html