By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

How to remove an element from an array

100+
P: 134
Hi, I have created an array using Lbound like below -


Function StoreForm(strtext)

If blDimensioned = True Then
ReDim Preserve strFrmNames(0 To UBound(strFrmNames) + 1) As String
Else

ReDim strFrmNames(0 To 0) As String
blDimensioned = True
End If
strFrmNames(UBound(strFrmNames)) = strtext
------------------------------------------------------------------------------------------------------
I can go thru the element one by one of an array and fire out the form

For lngPosition = LBound(strFrmNames) To UBound(strFrmNames)
frmName = strFrmNames(lngPosition)
Call Displayform(frmName)

Next lngPosition
End If

The Question is after I process each of the item, how should I delete the item from an array ? and do I have to redim ?

Please assist
Apr 29 '08 #1
Share this Question
Share on Google+
2 Replies


kadghar
Expert 100+
P: 1,295
The Question is after I process each of the item, how should I delete the item from an array ? and do I have to redim ?

Please assist
Yes, if you want to remove the nth element, then you should move one place form the (n+1)th element to the last one.

and yes, you should redim.

Anyway, i'll keep subscribed in case someone knows a better solution.
Apr 29 '08 #2

100+
P: 134
Yes, if you want to remove the nth element, then you should move one place form the (n+1)th element to the last one.

and yes, you should redim.

Anyway, i'll keep subscribed in case someone knows a better solution.
Thanks you so much, I take note on that
Apr 30 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.