Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › VB Help (Hitting Limits of Listbox)
New Posts  All Forums:Forum Nav:

VB Help (Hitting Limits of Listbox)

post #1 of 8
Thread Starter 
I've been tasked with updating a VB6 app that was written by someone else a couple of years ago. The purpose of the application is to produce a 'diff' report on a hierarchical object model (as a CASE tool plug in).

My problem is that the difference between the models have now grown to a magnitude where the number of items reported now exceeds the limits of the VB Listbox (given that if you try to contain more than 32767 items the Listbox.ListCount property returns a negative number and screws up a number of further operations).

Given that I'm not a VB programmer (I've spent years avoiding anything with a GUI) and my manager isn't prepared to allow the time to rewrite the whole application, what strategies would you suggest for dealing with the issue?

So far I have:
  • Cap the list at 32767 entries. Further changes are lost
  • Divide up the list results into a variable number of 'list pages'
  • Split the results into 'adds, deletes and changes and display each in a separate list (this might still hit cap issues in some situations)


I'm not sure that a tree view is a good idea for performance reasons given the size of the dataset. Any more suggestions on what to do with this apart from curse Microsoft for not thinking beyond the limits of a 16-bit integer?

NB Any suggestions need to be VB6-compatible (unfortunately)
post #2 of 8
Although I have only just started taking courses in VB, I have to ask which version of Visual Studio are you using? I've never had that many list box items, but it seems like it might be a limitation in an earlier version of the studio. I know that in class we had incompatibilities in editing between the 2003? and 2008 versions, though through compiling issues were removed.

Just my .02
post #3 of 8
Thread Starter 
As I said, it's Visual Basic 6. Unfortunately. I'm restricted in what I can use here for various reasons... VB.NET (i.e. Visual Studio 2003, 2005, or 2008) solutions are not an option

Nice sig pic btw
post #4 of 8
Technically, you can add more than 32767 items (int16) to the listbox but just can’t access the items beyond 32767. To work around this, if you can, you can use control such as listveiw to take advantage of 16bit Long data type but the appreance is different than listbox.
post #5 of 8
After you have reached 32767 items, store the whole range of data in a variable or even write to a file if you must. Then recall the information into the listbox control source.

This way you could have multiple "sets" of data and call each one up when needed.

The only problem here is that you may as well be rebuilding the entire app and in that case you may as well use 16bit controls and data types to store the information.
TJ07 Type R Build
(78 photos)
  
Reply
TJ07 Type R Build
(78 photos)
  
Reply
post #6 of 8
Thread Starter 
Quote:
Originally Posted by linskingdom View Post
Technically, you can add more than 32767 items (int16) to the listbox but just can’t access the items beyond 32767. To work around this, if you can, you can use control such as listveiw to take advantage of 16bit Long data type but the appreance is different than listbox.
I know you can add more than 32767 entries (because that's what I did without any VB complaining at all As you say, the issue comes out when you actually try to display beyond the limit. The scroll bar also caps out at 32767) and (as far as I can work out) the Listview also has a limit of 32767 entries.

The results are already in an internal data structure (effectively a paired array parsed directly from the CASE tool model) - the original problem was that the guy who implemented the tool used static arrays, which caused the tool to fall over when you exceeded the array limit. I fixed this problem, only to reveal the UI issue.

I think I'll probably go for the page's approach (effectively a 'window on the list' and display a couple of hundred at a time, with maybe a filter on top to further limit the display to items of interest.
post #7 of 8
Quote:
Originally Posted by Stormwolf View Post
I know you can add more than 32767 entries (because that's what I did without any VB complaining at all As you say, the issue comes out when you actually try to display beyond the limit. The scroll bar also caps out at 32767) and (as far as I can work out) the Listview also has a limit of 32767 entries.

The results are already in an internal data structure (effectively a paired array parsed directly from the CASE tool model) - the original problem was that the guy who implemented the tool used static arrays, which caused the tool to fall over when you exceeded the array limit. I fixed this problem, only to reveal the UI issue.

I think I'll probably go for the page's approach (effectively a 'window on the list' and display a couple of hundred at a time, with maybe a filter on top to further limit the display to items of interest.
The page's approach is a good solution. It works much better and may speed up the whole thing. Also, to use offline ADO data storage is another work around. Good luck.
post #8 of 8
Thread Starter 
Quote:
Originally Posted by linskingdom View Post
The page's approach is a good solution. It works much better and may speed up the whole thing. Also, to use offline ADO data storage is another work around. Good luck.
It'll certainly speed up the report generation stage which currently gives a good impression of a hung app ADO data storage is beyond the scope of this app, which is really just a difference reporting tool. The models are already stored in their own database.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › VB Help (Hitting Limits of Listbox)