SLOW Datagridview Looping for Search

  • Thread starter Thread starter Kevin993
  • Start date Start date
K

Kevin993

Guest
Greetings,

Looping through (For ... Next) cells of a dgv with more than approx. 10000 rows and 7 columns get quite slow. I know that it is matter of what's inside the cells (in this case, for the most crowded column, no more than 255 character) and also loop structure that passes cells in every iteration , for example using Instr to search for strings or using .Contains .

My first question: Is For .... Next a good way to do the searching ?

My second question : What is the most precise string-for-string search that doesn't make a dgv searching slow ?


P.S I populate my dgv this way :


Datagridview1.DataSource = ""
Dim dt2 As New DataTable()
Dim adp2 As New OleDb.OleDbDataAdapter("SELECT * FROM Table1", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\datasource.mdb;Persist Security Info=False;")
adp2.Fill(dt2)
Datagridview1.Datasource = dt2

Continue reading...
 
Back
Top