Search Tools Links Login

Remove Array Element


Remove an element from array by position.

'1. order is not preserved In this approach, but very simple
MyArray(ItemToBeDeleted) = MyArray( Ubound (MyArray))
Redim Preserve MyArray( Ubound (MyArray) - 1)

'2. order Is maintained
Dim i As Long , N As Long
'assumes N is the position In MyArray to remove
For i = N To Ubound (MyArray) - 1
MyArray(i) = MyArray(i + 1)
Next i
Redim Preserve MyArray( Ubound (MyArray) - 1)

About this post

Posted: 2021-02-14
By: ArchiveBot
Viewed: 152 times

Categories

Visual Basic 6

Attachments

No attachments for this post

Special Instructions

This content is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.