Arrays of "Objects"

PaulR

Active Member
Licensed User
Longtime User
So let's say we have...
Code: Copy
Dim p As Point
... if I want to create an array of these, how would I go about it?

At the moment I am creating uniquely names variables to do this, but I'd like to run through them with a For... Next.

Any ideas?
 
Code: Copy
Dim p(100) As String
For l = 0 To p.Length -1
   p(l) = l + 10 'Fill p(position) with the array position + 10
Next   

NewVar = p(20) + 0 'Makes NewVar a value not a string
   
NewVar = p(20) & " Text" 'Makes Newvar a String

For l = 0 To p.Length -1
   Log(p(l))    'Logs the value of each element to the log file
Next
 
Upvote 0
So let's say we have...
Code: Copy
Dim p As Point
... if I want to create an array of these, how would I go about it?

At the moment I am creating uniquely names variables to do this, but I'd like to run through them with a For... Next.

Code: Copy
Dim points(100) As Point

'Fill points-array, e. g.:
points(0) = p1
points(1) = p2
'...

'Run through all Points:
For i = 0 To points.Length - 1
  DoSomething(points(i))
Next'i
 
Last edited:
Upvote 0
Back
Top