I am testing several functions in VB6 for inclusion in a larger project. In order to test these functions before inserting them into the larger app, I have written some test code that requires a Global Array which can be updated from within each function. According to the docs, I should get a global array by DIMing it at the top of the module, but it doesn't seem to work. Below is a sample function and the code I'm using now.
CODE
DefLng A-Z
Dim GlobalArray(47) As Long
Dim NewGlobalArray(47) As Long
Public ShiftRight As Long
Public Function ShiftArray(ShiftRight As Long) As Boolean
Dim i As Long
Dim x As Long
If ShiftRight = 0 Then
ShiftArray = False
Exit Function
End If
For i = 0 To 47
If i <= 47 Then
x = i + Shiftright
If x > 47 Then
Exit For
Else
NewGlobalStateArray(x) = GlobalArray(i)
End If
End If
Next i
ShiftArray = True
End Function
It this function returns True, I display both the GlobalArray and the NewGlobal array in a TextBox for verification. That part seems to be working so I didn't post it.
It seems that I'm always running into simple problems that should be obvious, but they are not obvious to me. Please help if you can.
Stan Helton
This post has been edited by StanHelton: 26 Dec, 2007 - 12:51 PM