Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove element from an array in structure type.

Status
Not open for further replies.

panadoll

Programmer
Feb 28, 2002
52
SG
Hi all,

I encountered an error when trying to remove an element from my array which is of a user defined structure type

The following is the declaration of my structure type and array:-


Public Type PRICELIST
ItemNo As String
P1Price As Double
P2Price As Double
P3Price As Double
End Type

Public PriceArr() As PRICELIST


When I tried to remove 1 of the element using the following codes :-


PriceArr.Remove counter


It will prompt me an error message "Invalid qualifier" and immediately highlight the PriceArr.

Is there anyway of removing the element at the particular position?

Please do advice and thanks in advance.

Rgds,
Panadoll
 
Arrays don't have a remove method - doh! :)

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
You can assign the values in the array to a temp array. Then redim the original to the size you need and reassign the elememts you want to keep to the original array. Remembering to skip the assignmemt of the element that you want to remove.

zemp
 
You can use the VB class viewer to create a collection of PriceLists which will have all the necessary functionality, including Add and Remove.
-Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top