I'm trying to make a search inside a datagridview, looping through every cell and comparing 2 strings - SearchString and CellString.
I divide the work into four threads (by giving each thread a different quater of the rows to work with) that work in parallel. Threads CANNOT read one and the same cell at the same time, because they loop through different rows, so I don't think the error's there.
Each thread does the following:
dim CellString as string
For i As Integer = startrow To endrow
For Each cell As DataGridViewCell In DataGridView.Rows(i).Cells
CellString = cell.Value.ToString.ToLower ''Error appears here
If cell.ColumnIndex <> 4 Then
Select Case Compare(CellString, SearchString) ''complex function that compares 2 strings
''....
End Select
End If
Next
Next
The error I get is :
BindingSource cannot be its own data source. Do not set the DataSource and DataMember properties to values that refer back to BindingSource.
I don't get why this happens because i don't mess with the BindingSource nor with the DataSource. Also I don't do any updates I only read every cell as a string.
I couldn't find any similar problem, so any help is appreciated !