winforms - Populating a listview with a DataReader vb.net -
i have make modification application have perfomance issues. ran profiler , 1 of problem one:
a sql query made , stored in datareader. query returns 2000 rows.
then while loop start
dim monsql idatareader monsql = sql query while monsql.read strarray(0) = strarray(1) = strarray(2) = strarray(3) = monsql("something").tostring strarray(4) = monsql("something").tostring strarray(5) = monsql("something").tostring if not isdbnull(monsql("something")) strarray(6) = (monsql("something")) strarray(7) = monsql("something")).tostring strarray(8) = monsql("something").tostring strarray(9) = monsql("something").tostring strarray(10) = monsql("something").tostring end if objlistitem = new listviewitem(strarray) objlistitem.tag = lngnolot listview.items.add(objlistitem) loop
in while loop, data insert in listview
it takes quite time go throught loop (about 10 sec)
what option make things go faster?
try suspending drawing during loop updates:
listview1.beginupdate() // loop listview1.endupdate()
Comments
Post a Comment