Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make very long list?

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
DK

Even though you can add more than 32786 item to a list, you get an error if you try to access the listitems (list(33000) would produce an error).

How can I make a list with more than 32768 items in?

I know that it sounds like an unpractical long list, but the items are sorted and the list is a quick way to let the user find the item(s) that (s)he want to access.

Sunaj
 
Hi,
i cant add item to a list exceed 32737
Jimmy Le
nhan_tiags@yahoo.com
 
Hi,
MSDN say that: for ListBox "Maximum number of items is 32K; the limit on the size of each item is 1K (1024 bytes"

32* 1024 = 32786
I wonder how you can add more than 32786 items!?
(I dont mean to offend you!)

Jimmy Le
nhan_tiags@yahoo.com
 
Hi,

This works for me (and all the items are shown on the list).

-------------------------
Dim i As Long
For i = 1 To 35000
List1.AddItem i
Next i
-------------------------

VB6.0 SP5, Win NT
Sunaj

Any Ideas for making a long list?
 
Sunaj,

I'm sure that I do not understand the question. You show the code to add the items to the list box. Are you asking how to generate the set of items (relplacement for "i" as the item? If so, how to (reasonably) do this would depend on how the list is obtained. From MY perspective, I would just create a table of the items (or a query / group of queries if the items already exist in the app). But then (the table / query set in existance), I probably wouldn't consider attempting to place such a list in a combo/list box.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Hi MichaelRed

I haven't explained the background:
I'm reading a flat file which contains scientific data. The data was collected at certain positions (=stations) and the object of the program is to let the user extract selected stations from the flatfile into a new flat file.
I realize that this is an extremely oldfashioned system - but that's the way it is and there's is nothing I can do to change it.

The file typically contains much less than 32768 stations, but every now and then a file contains more stations.

The list works very nicely to select the stations that the user wants to extract (even with many stations on the list).

If you have any suggestions how to let the user select a number of stations without using the list or how to modify the list to cope with more than 32768 stations, pls let me know.


Sunaj
 
Try using a subform. The behavior won't be identical to a listbox, but it has no limits on the number of records.
 
I apologize, I had my Access hat on. How about trying a data grid.
 
Well,

For me, the real soloution would still include the generation / creation of the list in a table type recordset. I assume the stations 'available' overall would be relatively static, so for a given 'run' the application would be using just a subset of the table. A table with the StationId, a Flag (Yes/No) field to identify that it was in the current data set, and fields which would hold the values (if any?) would appear to be the structure. Without knowing the overall app, it is hard to know what else would be useful in the table. The next step would be to add the data to the table. If the dataset usage is a one time proocess, clear all of hte value field(s) and the flag field. Next, 'read' the table, setting the Flag field for each station, and placing hte value(s) into their fields. Simply use the table as the source of the info to be processed. The StationId field is just selected into the combo/list box, and it is used as the criteria for data selection.

If the date is re-used, the table needs am additioal field to Id the dataset, this could be by date/time, firl name or other info which would be unique to the data set. This would also necessitate that each file be checked before adding the records -to assure that duplications were not introduced. Also, you would not clear the flag and value fields.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 

Hi,

The stations 'available' overall is not static. We get new data on a daily basis. We currently have more than a million stations and with several thousand data values at each station, this is a total af several billion data values - and we're not ready for a relational database system yet.

This program is (supposed) to be a very small program, it's task is very simple: extract some lines from a flat file.
The only problem is to let the user select the part of the file that (s)he wants.

I think that I'll go for a simpler solution: If there's many stations I'll populate the list with the first part of the stations and let the user click on a button(scrollbar maybe) to view the rest of the list.

Thanks for your input.
Sunaj






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top