473,466 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Swapping collection items?

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"
Nov 21 '05 #1
2 1355
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" <sm****************@gtninc.com> escreveu na mensagem
news:Od*************@TK2MSFTNGP10.phx.gbl...
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"
Nov 21 '05 #2
Ronchese wrote:
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?
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a...
4
by: alanrn | last post by:
I am using a TreeView to display the hierarchy of a strongly-typed collection (inherited from CollectionBase). The order of the nodes in the TreeView is strictly tied to the order in which they...
7
by: deancoo | last post by:
Ok, I've got a vector I've filled with a LOT of data, and after massaging it just right, I need to copy it all over to a map where I'll have the advantage of assigning a custom key as the key...
2
by: S. Justin Gengo | last post by:
Hi, I've created a component that allows me to store database information for various types of databases my company uses. It uses a collection for each type of database. Everything is working...
3
by: Matt Michael | last post by:
I have a listview control and a collection object right now that I'm trying to pass information to and from. Whenever I click on the checkbox, I want it to remove certain listview items and add...
6
by: rodchar | last post by:
hey all, Dim _oItems As Outlook.Items Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox) _oItems = oInbox.Items I can iterate thru this with a...
0
by: Rene Aichinger | last post by:
Hi, I've created a server control (it inherits from WebControl) wich has a property of genertic collection type. The type of the generic collection is NavigationItem, a little class I've...
6
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
11
by: Jiang Nutao | last post by:
Hi, I simplify my problem like below To convert list aa = into How to do it fast? My real list is huge.
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.