Thousands of Rows in a Listbox- Visual Basic 2010

Discussion in 'Programming' started by FPForum, Nov 10, 2012.

  1. #1
    Hey everyone..I hope there are some VB experts around that may know the best way to handle thousands of rows in a listbox?

    I'm using Visual Basic Express 2010 and am trying to download a zip file, unzip it, and load the text file into a listbox or textbox. I have the file downloaded and unzipped properly but when trying to load this many records the program takes forever.

    I was reading that a JET database may do what I'm looking for but I'm curious if anyone has experience with another method? The idea is that this list will load (about 60-100K) records and then people will be able to filter the list. I need a good way to get this to load quickly and be able to filter quickly..

    Any suggestions would be appreciated!
     
    FPForum, Nov 10, 2012 IP
  2. Anonimista

    Anonimista Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #2
    What do you use to load the data? In my experience using StreamReader.ReadToEnd() and String.Split() to read a text file into an array is relatively fast, it is probably adding items to ListBox that's slow. One thing I can think of, you could try to load the file into a DataTable (or a List) and use it as DataSource to display the lines in a DataGridView, but that depends on your filtering requirement.
     
    Anonimista, Nov 11, 2012 IP
  3. FPForum

    FPForum Notable Member

    Messages:
    4,172
    Likes Received:
    102
    Best Answers:
    0
    Trophy Points:
    225
    Digital Goods:
    2
    #3
    Hey Anonimista..I managed to get it working nicely..

    I added .SuspendLayout before adding the rows and then .ResumeLayout after..Seams to fix the issue I was having.

    Thank you anyways for your response.
     
    FPForum, Nov 11, 2012 IP