I have been trying to assign value to an object array that is defined as follows…
Dim englishTextAry As Object(,) = New Object(,) {}
I am looping through a dataReader and trying to assign the values to this array with the following code….
While rdr.Read()
Dim recID As String = rdr.Item(0)
Dim dataVal As String = rdr.Item(1)
ReDim Preserve englishTextAry(recID, dataVal)
End While
But the ReDim is throwing an error on dataVal not being an Integer.
What am I doing wrong here? Can anyone point me in the right direction?
Thanks,
You’ll be doing a horrible number of ReDims for a non-small numbers of rows. You could use a Class to hold the id-value pairs and a list to hold them:
…and to answer your question, the ReDim statement takes numbers for the sizes to ReDim to.