I'm am creating a "pop-up" CheckedListBox over a button on my DataGridView. The values in the list are going to be filtered based on the value in column 0 of the DataGridView.
I have already pulled in a "master" DataTable with two columns: ACODE and MATRIX.
I want to call the following function and return an array of strings that I can use to build this CheckedListBox with. The line between "For Each r" and "Next" generates a "Number of indices is less than the number of dimensions of the indexed array". The number of items is variable in the array so I can't predefined it. I know I'm going down the wrong path.
Private Function StudyGroupSamples(ByVal sampleType As String) As String()
Dim thisArray() As String
Dim theseRows() As DataRow
Debug.Print(sampleType + vbNewLine)
theseRows = ds.Tables("AnalysesForSampleTypes").Select("MATRIX = '" + sampleType + "'")
For Each dr As DataRow In theseRows
thisArray().Add(dr.Item("ACODE").ToString)
Next
End Function
I'm willing to scrap this code. What can I do to get the array of one column in the DataRows collection into my CheckedListBox?