0

hello
I would like to know if it is possible to store an array within a structure. For examples for recording people with more than one name. Like this:

Structure Product_Reccord
Dim PNames(3) as string
end structure
It is giving me an error, help please!!

Edited by london-G: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by NeilClayton
0

Ok I think i see the error you mean.
You can but you cannot give it an initial size.

Try this

Structure Product_Reccord
Dim PNames() as string
end structure

You could then do

Dim test As Product_Reccord
ReDim preserve test.PNames(3)
test.PNames(1) = "I think this might just work"
MsgBox(test.PNames(1))

The redim preserve allows you to change the size of your array and keep the existing entries
I Hope this helps

Edited by NeilClayton: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.