P PaulR Active Member Licensed User Longtime User Mar 22, 2012 #1 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?
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?
margret Well-Known Member Licensed User Longtime User Mar 22, 2012 #2 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
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
J Jost aus Soest Active Member Licensed User Longtime User Mar 22, 2012 #3 PaulR said: 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. Click to expand... 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: Mar 22, 2012 Upvote 0
PaulR said: 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. Click to expand... 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
P PaulR Active Member Licensed User Longtime User Mar 22, 2012 #4 Holy moly, it was that simple. Oops. Thanks very much indeed. Upvote 0