Swapping collection items?

  • Thread starter Thread starter Sam Marrocco
  • Start date Start date
S

Sam Marrocco

Does anyone know of a method of swapping collection items? For example:

Current collection:
..Item(1)="a"
..Item(2)="b"
..Item(3)="c"

After swapping items 2 and 1....
..Item(1)="b"
..Item(2)="a"
..Item(3)="c"
 
Tryied it already?

objTemp = .Items(2)
..Items(2) = .Items(1)
Items(1) = objTemp

You can make a function to do it (e.g. SwapItems(Item1 as object, Item2 as
object)


--
[]s
Cesar





"Sam Marrocco" <[email protected]> escreveu na mensagem
Does anyone know of a method of swapping collection items? For example:

Current collection:
..Item(1)="a"
..Item(2)="b"
..Item(3)="c"

After swapping items 2 and 1....
..Item(1)="b"
..Item(2)="a"
..Item(3)="c"
 
Ronchese said:
Tryied it already?

objTemp = .Items(2)
.Items(2) = .Items(1)
Items(1) = objTemp

You can make a function to do it (e.g. SwapItems(Item1 as object, Item2 as
object)


Perhaps I'm missing something here....isn't the item() property a
read-only property of a collection?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top