|
-
Jan 30th, 2000, 07:14 AM
#1
Thread Starter
New Member
Hello,
I got a problem.
I have a sub2(i,n) which consists of a For Next statement.
sub2(i,n)
For l(i)=1 to n
.......
......
i=i+1
n=n-1
Call sub2(i,n)
Next
End sub
So i get nested for next loops.
So when it has called all the same subs within sub2 he has to loop through all those for next statements.
The problem is that it doesn't use the corresponding i and n in the different loops anymore which I passed as value. Instead he uses the last values passed.
How can i tackle this?
Any help greatly appreciated...
Kind regards,
Gertjan Oonk
-
Feb 1st, 2000, 12:06 PM
#2
Junior Member
If I understand you well, you want your i and n values to be passed by value. VB receives parameters by reference by default.
There is two way to force VB to pass parameters by value:
sub2(ByVal i, ByVal n)
or on the call
Call sub2 (i), (n)
Hope it will help...
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
|