I have two sets of jagged arrays, named P1 through P6 and Z1 through Z6, the contents of which are fruit in the P arrays and cars in the Z arrays. I also have a function that will obtain a value from one of these arrays:
Public Function retL(ByVal L As Array)
Dim maxL As Integer = L.GetUpperBound(0)
Dim numL As Integer = randomizer(maxL)
Dim resL As String = L.GetValue(numL - 1)
Return resL
End Function
L, in the above, is constructed by the following piece of code:
Dim L As String = "P" & randomizer(6)
or
Dim L As String = "Z" & randomizer(6)
So, my issue is that none of this is working. Because L is constructed as a string, but then called by retL as an array, it fails. If I attempt to construct L as an array to begin with, it fails. If I attempt to call it as a string, it fails. I'm lost and confused as to where to proceed from here. Obviously what I'm trying to do is possible, but I've also obviously either missed an important step or I'm not grasping some basic concept.
Any suggestions?
Arrayin your code. Instead, always look for an array of some specific type.