Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Need fast way to populate treeView

Need fast way to populate treeView

Scheduled Pinned Locked Moved C#
csharpquestion
6 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have a need to populate a treeview control with a file containing as much as 500,000 lines of data. The data file contains information that could be saved as an Excel .xls file, or a .csv file, or a straight text file. I have a C# project that reads the data from an excel file and populates my treeview control, but it takes FOREVER for just 25,000 lines. And Excel files have the 65K line limit anyway. Can someone tell me what the fastest methode would be to populate a treeview control with data from a file that could contain as many as a half a million lines or more? Thanks.

    V L M W 4 Replies Last reply
    0
    • L Lost User

      I have a need to populate a treeview control with a file containing as much as 500,000 lines of data. The data file contains information that could be saved as an Excel .xls file, or a .csv file, or a straight text file. I have a C# project that reads the data from an excel file and populates my treeview control, but it takes FOREVER for just 25,000 lines. And Excel files have the 65K line limit anyway. Can someone tell me what the fastest methode would be to populate a treeview control with data from a file that could contain as many as a half a million lines or more? Thanks.

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      That would say would be a horrendifying experience to the user loading from a text file considering the largest wait time unless the system had enough powerful horsepowers to process it as if it possessed a magical wand. :rolleyes:

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      1 Reply Last reply
      0
      • L Lost User

        I have a need to populate a treeview control with a file containing as much as 500,000 lines of data. The data file contains information that could be saved as an Excel .xls file, or a .csv file, or a straight text file. I have a C# project that reads the data from an excel file and populates my treeview control, but it takes FOREVER for just 25,000 lines. And Excel files have the 65K line limit anyway. Can someone tell me what the fastest methode would be to populate a treeview control with data from a file that could contain as many as a half a million lines or more? Thanks.

        L Offline
        L Offline
        L Henson
        wrote on last edited by
        #3

        Just a couple of ideas: 1) Call BeginUpdate before you add the nodes and then EndUpdate once you are done. 2) If possible, use the Nodes.AddRange method instead of the Nodes.Add method. Regardless, half a million lines in a treeview sounds a tad daft...

        1 Reply Last reply
        0
        • L Lost User

          I have a need to populate a treeview control with a file containing as much as 500,000 lines of data. The data file contains information that could be saved as an Excel .xls file, or a .csv file, or a straight text file. I have a C# project that reads the data from an excel file and populates my treeview control, but it takes FOREVER for just 25,000 lines. And Excel files have the 65K line limit anyway. Can someone tell me what the fastest methode would be to populate a treeview control with data from a file that could contain as many as a half a million lines or more? Thanks.

          M Offline
          M Offline
          martin_hughes
          wrote on last edited by
          #4

          I think your approach is wrong here - populating anything user oriented (except my bank account) with 500,000 somethings is pointless. No user would be able to make sense of that much data.

          "It was the day before today.... I remember it like it was yesterday." -Moleman

          P 1 Reply Last reply
          0
          • M martin_hughes

            I think your approach is wrong here - populating anything user oriented (except my bank account) with 500,000 somethings is pointless. No user would be able to make sense of that much data.

            "It was the day before today.... I remember it like it was yesterday." -Moleman

            P Offline
            P Offline
            pbraun
            wrote on last edited by
            #5

            I agree. The approach is wrong. There are other approaches that work better. I'm betting that someone somewhere has implemented a control that can keep a portion of the file in the visible window while the user scrolls up or down. It may not be the ideal solution, but it definitely is not the worst.

            Phil

            1 Reply Last reply
            0
            • L Lost User

              I have a need to populate a treeview control with a file containing as much as 500,000 lines of data. The data file contains information that could be saved as an Excel .xls file, or a .csv file, or a straight text file. I have a C# project that reads the data from an excel file and populates my treeview control, but it takes FOREVER for just 25,000 lines. And Excel files have the 65K line limit anyway. Can someone tell me what the fastest methode would be to populate a treeview control with data from a file that could contain as many as a half a million lines or more? Thanks.

              W Offline
              W Offline
              Whytespot
              wrote on last edited by
              #6

              Load it dynamically. On form load, load the first-level tree nodes, and when the user expands and individual node load it's children. If they are all first-level nodes you have some serious design issues to deal with.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups