|
-
Nov 14th, 2010, 06:00 AM
#1
Thread Starter
Junior Member
Function variable to be seperate for each call....
Hi,
Lets say i have:
Private Function TestFunction (byval VariableA as SomeClass)
Static VariableB as integer
VariableB = variableA.position
Return Nothing
End Function
I then do:
For i = 1 to 100
TestFunction(InputA)
Next
So i used static so variableB still has value from previous loop.
This is no problems, but if i want to do
For i = 1 to 100
TestFunction(InputA)
TestFunction(InputB)
TestFunction(InputC)
Next
It uses the same VariableB to get .position from InputA, InputB and InputC so at the end of the loop, it is VariableB = InputC.
How can i make it use a seperate VariableB for each function call?
So at end of loop,
Function call 1 has VariableB = inputA.position
Function call 2 has VariableB = inputB.position
Function call 2 has VariableB = inputC.position
So how can i make each TestFunctionB line seperate from the others?
Um.. I am not sure if i make any sense but I am in a hurry right now. If it needs to be explained clearer please reply and I try make more sense.
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
|