Jesus112398
asked on
Manipulating Arrays
Please could someone offer the shortest code to do the following:
Delete an element in the middle of a dynamic array meaning all the elements above that one in the set are pushed down one.
Test whether a variable equals that of an element in an array.
Thanks
Delete an element in the middle of a dynamic array meaning all the elements above that one in the set are pushed down one.
Test whether a variable equals that of an element in an array.
Thanks
It would be mouch easier if you used a collection , then you would have no need to resize the array after a delete , but thats just my opinion
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Comments to the proposed answer:
Redim will clear the contents of the array and you will lose the values of all the elements. You have to use keyword PRESERVE to keep the contents of the elements:
ReDim preserve a(1 To 9) As String
Good luck
Redim will clear the contents of the array and you will lose the values of all the elements. You have to use keyword PRESERVE to keep the contents of the elements:
ReDim preserve a(1 To 9) As String
Good luck
Of course you have to use Preserve!. I forgot writing it in my code. Sorry about my mistake and thanks for pointing it out.