For Each row As DataRow In _ds2.Tables(0).Rows
Redim Preserve arr(j)
arr(j) = row(0).ToString
j = j + 1
Next
But why not using an arraylist
Dim l_arr as ArrayList
l_arr=New ArrayList(_ds2.Tables(0).Rows.Count)
'l_arr=New ArrayList() is oke too, your arraylist shall then dynamicly be
resized
For Each row As DataRow In _ds2.Tables(0).Rows
l_arr.Add(row(0).ToString)
Next
"amber" <am***@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Can someone please help me out?
I have a dataset that contains 1 column.
I'm trying to populate an array from this column.
I'm using the code pasted below, and keep getting the following error on
the
4th line of code:
Object reference not set to an instance of an object.
Dim arr() As String
Dim j As Integer = 0
For Each row As DataRow In _ds2.Tables(0).Rows
arr(j) = row(0).ToString
j = j + 1
Next
TIA,
Amber