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 / C++ / MFC
  4. ListBox

ListBox

Scheduled Pinned Locked Moved C / C++ / MFC
helpalgorithmsquestion
6 Posts 5 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.
  • M Offline
    M Offline
    Mike Winter
    wrote on last edited by
    #1

    After you all sorting out my problem with adding strings to a listbox, I now have a few more questions about them: Is ther a limit to the amount of strings that can be added to a ListBox? My application will run indefinitly, so could end up having a huge amount of text entered into it - will this be a problem? If it is, is there an easy way to limit the amount of strings, so that if you enter more into the ListBox, the first ones (oldest) will fall off the List? Thansk for all your help Mike

    realJSOPR 1 Reply Last reply
    0
    • M Mike Winter

      After you all sorting out my problem with adding strings to a listbox, I now have a few more questions about them: Is ther a limit to the amount of strings that can be added to a ListBox? My application will run indefinitly, so could end up having a huge amount of text entered into it - will this be a problem? If it is, is there an easy way to limit the amount of strings, so that if you enter more into the ListBox, the first ones (oldest) will fall off the List? Thansk for all your help Mike

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      I think the limit is either 16000 or 32000 strings. I seem to remember seeing a virtual list box article on CP somewhere. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      M 1 Reply Last reply
      0
      • realJSOPR realJSOP

        I think the limit is either 16000 or 32000 strings. I seem to remember seeing a virtual list box article on CP somewhere. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        M Offline
        M Offline
        Mike Winter
        wrote on last edited by
        #3

        Thanks John I just did an experiment with my app, and it hung once I had written 32736 lines into it! In a normal day, I shouldnt be adding more than 100 lines of text a day to the ListBox, so that would mean i could run the app for approx 1 year before this would become an issue. Still, it would be nice to block the problem from happening... Thanks again Mike

        M M D 3 Replies Last reply
        0
        • M Mike Winter

          Thanks John I just did an experiment with my app, and it hung once I had written 32736 lines into it! In a normal day, I shouldnt be adding more than 100 lines of text a day to the ListBox, so that would mean i could run the app for approx 1 year before this would become an issue. Still, it would be nice to block the problem from happening... Thanks again Mike

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

          as john suggested, use a virtual listbox ... search this site on how to do it; it's not at all complicated ...


          Maximilien Lincourt Your Head A Splode - Strong Bad

          1 Reply Last reply
          0
          • M Mike Winter

            Thanks John I just did an experiment with my app, and it hung once I had written 32736 lines into it! In a normal day, I shouldnt be adding more than 100 lines of text a day to the ListBox, so that would mean i could run the app for approx 1 year before this would become an issue. Still, it would be nice to block the problem from happening... Thanks again Mike

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            LB_ADDSTRING returns LB_ERRSPACE if the list is full. You can then delete the oldest item and add the new one. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

            1 Reply Last reply
            0
            • M Mike Winter

              Thanks John I just did an experiment with my app, and it hung once I had written 32736 lines into it! In a normal day, I shouldnt be adding more than 100 lines of text a day to the ListBox, so that would mean i could run the app for approx 1 year before this would become an issue. Still, it would be nice to block the problem from happening... Thanks again Mike

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Do you really want to wade through several thousand items in the listbox? Why not create a circular list (i.e., older items get replaced by newer items) that only holds a small amount of items? The listbox could then show the contents of this list.


              "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

              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