473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to remove an element from an array

134 100+
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
2 1576
kadghar
1,295 Expert 1GB
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
jamesnkk
134 100+
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

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

Similar topics

12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
6
by: Rimuen | last post by:
Have a string contains numbers from database. But there is similar numbers want to remove Example: 1,3,6,6,6,12,13,14,15,15,15,15 Want to remove the similar numbers so it would be like:...
11
by: koperenkogel | last post by:
Dear cpp-ians, I am working with a vector of structures. vector <meta_segment> meta_segm (2421500); and the structure look like: struct meta_segment { float id; float num;
7
by: Derek Basch | last post by:
I can remove objects from an array by doing this: for (i in oCache){ if (i == "test"){ delete oCache; }; }; However, the array's length property is unaffected.
3
by: Don | last post by:
My user control has a combobox with an arraylist attached to it along with custom add and remove methods. The "Add" method is working great. However I don't understand why the "Remove" method...
4
by: eksamor | last post by:
I have a simple linked list: struct element { struct element *next; int start; }; struct list { struct element *head;
14
by: oLgAa25 | last post by:
Hello all, I am back I have this question everything compiles fine, but I just need to check for an index that is more than the array size. Although it says out of bound, but it is still...
11
by: Richard Maher | last post by:
Hi, I have read many of the copius entries on the subject of IE performance (or the lack thereof) when populating Select Lists. I don't mind the insert performance so much, (I get 100x120byte...
3
by: Barkingmadscot | last post by:
I am stuck, i can workout how to remove lines from an array I have loading a text file (a Log), I know which lines a need, but the logs can be upto 30K sometimes bigger. I found trying to...
6
by: tedpottel | last post by:
Help How can I remove an item from an array, Example Array=3, array=6 array=7 array=9 Is there a way to remove a item, say index 1, so the array would now be Array=3 array=7 array=9 ?????
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.