I have this sub :
Private Sub error_out(ByVal line As Integer, ByVal err_col As Integer, ByVal err_msg As String)
Dim ln = t_erori.Rows.Add
ln.Item(0) = line
ln.Item(err_col) = err_msg
ln.Item(3) = err_col
End Sub
This is being called by several functions running in a parallel.for loop.
The problem is that sometimes (totally random) i get an error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
on the Dim ln = t_erori.Rows.Add
line.
I suspect this is because it's trying to add the same row twice. How can i make this work ? Or what else method could I use to do this ?
I need this datatable because my app is writing some results in there, but any other method to store the results that works with parallel.for would be ok.