Hello guys, thanks so much.
Please i have this issue again. I feel i have properly written my code in this invoke code. I initialized a temp data table simply by cloning the main data table. Now i loop into the main data table to find rows with the parameters i want.
It finds these row … my problem is at that if condition i simply want to insert these rows into the clone of the data table (Temp data table).
The error i get is “Invoke code: Exception has been thrown by the target of an invocation.”… i have commented out every other thing to find out the error is actually coming from that line.
TempData.Rows.Add(Row)
below is my code
Dim ListOfIndexToRemove As List(Of Int32) =New List(Of Int32)
TempData = dtInputdata.Clone
For Each Row As DataRow In dtInputdata.Rows
If Not String.IsNullOrWhiteSpace(Row(PartnerIndexColumn).ToString) And Not String.IsNullOrWhiteSpace(Row(DescriptionIndexColumn).ToString) Then
Dim PartnerName As String = Row(PartnerIndexColumn).ToString.Replace(" “,String.Empty).ToLower
Dim Description As String = Row(DescriptionIndexColumn).ToString.Replace(” ",String.Empty).ToLower
'---------Checking if row item is in the said category------------------------------------------
If PartnerName.Contains(in_PartnerName) And Description.Contains(in_DescriptionName) Then
console.WriteLine(“i found match”)
TempData.Rows.Add(Row)
'ListOfIndexToRemove.Add(dtInputdata.Rows.IndexOf(Row))
End If
'-------------------------------------------------------------------------------------------
End If
Next
'--------------delete Index of Categories found---------------------
'If ListOfIndexToRemove IsNot Nothing AndAlso ListOfIndexToRemove.Count > 0 Then
'For Each Index As Int32 In ListOfIndexToRemove
'dtInputdata.Rows(Index).Delete
'Next
'End If
'--------------------------------------------------