Multidimensional dynamic Arrays in vb.net
Hi Everyone,
Ive come across the need for a Multidimensional dynamic Array however its causing a headache so can anyone shed any light on the matter...
VB Code:
Dim CusArray(,)
Dim i, j As Integer
i = 0
j = 0
While MyReader.Read
CusArray(i, 0) = "1" 'MyReader("CustomerId")
CusArray(i, 1) = "Carl Blanchard" 'MyReader("FullName")
End While
ReDim Preserve CusArray(LBound(CusArray), UBound(CusArray))
MsgBox(CusArray(0, 0))
I get this error saying "Object reference not set to the instance of the object" which is caused my CusArray(i, 0) = "1" 'MyReader("CustomerId") However if i try and Dim CusArray(,) as New Array it dosnt allow me just says Arrays cant not be declared with New- ive read loads of posts on here but none help, most of them are vb6 and not .net,
I will know the size of the size of the subscript which will be max of 11 however this array is made up from records out of my db so i will not know the size of the Index......
Can any one help, code examples would be good
thanks Carl