|
-
Jan 21st, 2000, 03:46 AM
#1
Thread Starter
Addicted Member
If I have 10 elements in an array, how can I delete element from slot number 5 and move the element that was in slot number 6 to slot number 5 and then leave slot number 10 empty.
Example:Before
---------------
Slots--Element
--[1]---[Name1]
--[2]---[Name2]
--[3]---[Name3]
--[4]---[Name4]
--[5]---[Name5]
--[6]---[Name6]
--[7]---[Name7]
--[8]---[Name8]
--[9]---[Name9]
-[10]---[Name10]
Example:After - Remove Element 5
----------------------------------
Slots--Element
--[1]---[Name1]
--[2]---[Name2]
--[3]---[Name3]
--[4]---[Name4]
--[5]---[Name5] - previously Element-6
--[6]---[Name6] - previously Element-7
--[7]---[Name7] - previously Element-8
--[8]---[Name8] - previously Element-9
--[9]---[Name9] - previously Element-10
-[10]---[Empty]
------------------
OmarSwan
[email protected]
http://www.omarswan.cjb.net
To God Be The Glory
-
Jan 21st, 2000, 04:41 AM
#2
Member
If it's ok try to use collection.
Dim testCol As New Collection
testCol.Add "1"
testCol.Add "2"
testCol.Add "3"
testCol.Add "4"
testCol.Add "5"
testCol.Add "6"
testCol.Add "7"
testCol.Add "8"
testCol.Add "9"
testCol.Add "10"
'Remove element 5
testCol.Remove 5
' After you remove element5, there are 9 elements left in the collection. If you want to keep number of elements, then simply add one with empty string.
This will become the last element(10) of your collection.
testCol.Add ""
MsgBox testCol(5)
MsgBox testCol(10)
Joon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|