Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Public Sub processx(ByVal x)
Dim i As Integer
Dim n As Integer = x.GetLength(0) - 1
Array.Clear(arr, 0, UBound(arr))
Array.Clear(ndx, 0, UBound(ndx))
ReDim arr(n)
ReDim ndx(n)
For i = 1 To n
arr(i) = x(i)
ndx(i) = i
Next
End Sub
Dim ndx1() As Integer
ReDim ndx1(ndx.GetUpperBound(0)) 'So that it is the right size to receive the copy
ndx.CopyTo(ndx1, 0)
Use ndx1 in your thread. Since it is a copy, it is completely independant from ndx and changes that you make on one won't break the job that you are doing on the other.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.