|
-
Jun 29th, 2012, 12:19 PM
#1
Thread Starter
New Member
tips array and collection
Hello,
I need a piece of advice on a problem that I have.
I read a list of numbers from a txt file, this list changes over time.
For each number of this list (I don't' know how many they are, they can be 10 or 200) I have to create a new array where I have to put inside other values. I don't want to use a muldimensional array because I have to to know often how many values I have in each array and add o remove new values inside of it. I have thought to use the collection, but i'have read that are slow.
How can I declare the arrays without know how many I need?
Thanks in advance for the answer.
Claudio.
-
Jun 29th, 2012, 12:48 PM
#2
Re: tips array and collection
A couple of ways come to mind. The most flexible method is to define a custom class. But a shortcut might be to just declare a custom type:
Code:
Private Type Foo
ID As Long
Data() As Long
End Type
Private m_Array() As Foo
.....
Private Sub FooThis()
Dim i As Long
ReDim m_Array(SomeNumber)
For i = 0 To UBound(m_Array)
ReDim m_Array(i).Data(SomeOtherNumber)
Next i
End Sub
It's quick (to code), but dirty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|