Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Datagridview too slow when making rows invisible

$
0
0

I am trying to filter about 80,000 rows in a datagridview by making rows that do not meet the filter condition invisible but this seems to take forever. Is there anyway to do it better. Below is a sample code:

For Each row As DataGridViewRow In dgvSaleLogByProduct.Rows
        If DatePart(DateInterval.WeekOfYear, DateTime.ParseExact(CDate(row.Cells("pDate").Value), "dd/MM/yyyy", Nothing)) <> _
        DatePart(DateInterval.WeekOfYear, Today.Date) And _
             DatePart(DateInterval.Year, DateTime.ParseExact(CDate(row.Cells("pDate").Value), "dd/MM/yyyy", Nothing)) <> _
              DatePart(DateInterval.Year, Today.Date) Then
          dgvSaleLogByProduct.Rows.Item(row.Index).Visible = False
        End If
      Next

I also want to be able to use the results of a filter as the source for another filter. You help will be very much appreciated.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>