Performance issue with datagridview
Describe the bug Describe what you tried and what did not work as expected.
Code snippets Show code snippets of the part that did not work.
Screenshots Add screenshots of FlaUInspect/Inspect to show your controls with issues.
Additional context Add any other context about the problem here.
I am trying to process the rows in a datagridview. Everything works, but accessing each of the three cells in a row takes about 9 seconds. Not sure if I'm going about it wrong, here is the code:
grid = UIElements(idx).dgv
For i As Integer = 0 To grid.Rows.Count - 1
LogStatus("processing row " & i & " " & (CInt((Now - lastcheck).TotalMilliseconds)))
lastcheck = Now
s = grid.Rows(i).Cells(0).Value
s = grid.Rows(i).Cells(1).Value
s = grid.Rows(i).Cells(2).Value
Next
I figured out how to make it faster, still not quite fast enough, but. If I get all the rows at once, e.g. rows = grid.rows, then get all the cell values at once as well. Not sure why accessing a datagridview is so much slower than other controls, but at least it's manageable now.