Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Array Elements...

Status
Not open for further replies.

ultrafresh

Programmer
Joined
Aug 30, 2002
Messages
1
Location
CA
I am storing a list of pages in an array stored in session ... the pages are games and when you complete a game you come back and are sent to a different random game... i want to be able to remove the game that you just played so that I don't choose it again. Is there some function that I can use to cut the element that I just selected out of an array?
 
Use the Filter function...
Code:
aTmp = Filter(aOrig, aOrig(x), False, vbBinaryCompare)
ReDim aOrig(UBound(aOrig) - 1)
aOrig = aTmp
Be aware that this treats the comparison argument (aOrig(x)) as a string and will exclude all elements containing that string [i.e.: (a.asp, b.asp, aa.asp, ab.asp, bb.asp) filtered on the second element (b.asp) would result in (a.asp, aa.asp, , )], so ensure your page names are unique enough. Otherwise, I could provide another method, but it is more drawn out...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top