FlaUI icon indicating copy to clipboard operation
FlaUI copied to clipboard

Performance issue with datagridview

Open danhi opened this issue 4 years ago • 2 comments

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.

danhi avatar Feb 16 '21 19:02 danhi

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

danhi avatar Feb 16 '21 19:02 danhi

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.

danhi avatar Feb 16 '21 20:02 danhi