Current code for trying to get the matches from the selection in a combobox by transplanting data from myData array to TempArray, where comboboxes can be repopulated from the condensed list:
This is where I am struggling. Maybe my whole process needs to be reconsidered from the excel data extraction?
Code:Sub myReadArrayandExtractRange() Dim bound0 As Integer = myData.GetUpperBound(0) ' Rows Dim bound1 As Integer = myData.GetUpperBound(1) ' Columns Dim mySender As String = QuoteNumber.Text ' name of combobox and excel a1 - Change later to event handler Dim myDBColumn As Integer = 1 ' excel column number - Change later to event handler pass Dim tempArrayRows As Integer = 0 ' Count of matches in loop k ' k loop counts sender matches in myData column X for dimensioning TempArray For k As Integer = 1 To bound0 If myData(k, myDBColumn).ToString = mySender Then tempArrayRows = tempArrayRows + 1 End If Next k 'Dimension TempArray from matches Dim tempArray(tempArrayRows, bound1) ' i loop iterates each row in myData looking for a match to sender For i As Integer = 1 To bound0 If myData(i, myDBColumn).ToString = mySender Then ' ji loop changes to each row in TempArray For ji = 1 To tempArrayRows ' j loop moves across a row to each column of data and write the data to TempArray For j As Integer = 1 To bound1 tempArray(ji, j) = myData(i, j) Next j Next ji End If Next i End Sub




Reply With Quote
