Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bugs in ListView with more then 32768 Items

20 views
Skip to first unread message

Gerhard Rock

unread,
Jan 14, 2002, 5:25:23 AM1/14/02
to
I have more than 32768 Items in a ListView.
The Events "Item_Click" and "Item_Check" do not work.
If I click or check an Item greater than Index=32768 I
always get back Item with Index 1.

Can anyone give me a hint to solve this problem ???

Mathias Wührmann

unread,
Jan 14, 2002, 8:40:44 AM1/14/02
to
Hi,

The listview is limited to 32768 items! Therefore, if you need to work with
that much items, you have some options:

1. Limit the number of items that a shown at a time! For example, if you are
showing names in it, simly add buttons or any selection field with letters
a-z, so only names from that letter are shown at a time. Think about this
carefully! Does it REALLY make sense to show 32768 items or wouldn't it be
better for the user to make some kind of pre-selection? If you search for
"Wilson", its surely faster to select "W" and scroll through those 500 names
as having "Abraham" to "Zulu" in the list and searching for "Wilson" in
32000 items.

2. Develop an user-defined listview-control that will show that much items

3. Buy a third-party listview-control that will hold that much items or see
if you can get a free one from any source-code sites

Regards,

Mathias Wuehrmann

"Gerhard Rock" <gerhar...@joanneum.ac.at> schrieb im Newsbeitrag
news:302801c19ce5$c67e62e0$95e62ecf@tkmsftngxs02...

MikeD

unread,
Jan 14, 2002, 7:17:01 PM1/14/02
to

"Gerhard Rock" <gerhar...@joanneum.ac.at> wrote in message
news:302801c19ce5$c67e62e0$95e62ecf@tkmsftngxs02...

Well.....what you really need to do is consider a design change. 99.9% of
users are NOT going to like scrolling through 32000+ items in the ListView.

However, by adding the following line of code to both the Item_Click and
Item_Check events, you can work-around the specific problem you're having.


Set Item = ListView1.SelectedItem


Naturally, use the actual name of your ListView control.

Mike

MikeD

unread,
Jan 14, 2002, 7:32:27 PM1/14/02
to

"Mathias Wührmann" <NOmwue...@hotmail.com> wrote in message
news:u0YLNHQnBHA.2440@tkmsftngp07...

> Hi,
>
> The listview is limited to 32768 items! Therefore, if you need to work
with
> that much items, you have some options:
>

I'm afraid you are incorrect. The ListView has no inherent limit, other
than available memory. The problem Gerhard described appears to be a bug,
although I can neither confirm nor deny that as a fact. Try this code:

Option Explicit

Private Sub Form_Click()

Dim Index As Long

MousePointer = vbHourglass

With ListView1.ListItems
For Index = 1 To 50000
.Add , , CStr(Index)
Next
End With

MousePointer = vbDefault

End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)

MsgBox Item.Text

Set Item = ListView1.SelectedItem
MsgBox Item.Text

End Sub

When you click a ListItem, the first msgbox will display 1 if the ListItem
is greater than 32768, just as Gerhard described. However, the second
msgbox will display the correct text for the ListItem that was clicked.

Incidently, this was VB6 and the VB6 version of Windows Common Controls. I
didn't test any of this with VB5 or the VB5 version of Windows Common
Controls. I also have no idea if you might run into this same problem
elsewhere. The best solution is to reduce the number of ListItem objects.
32000 is WAY too many.

Mike

Mathias Wührmann

unread,
Jan 15, 2002, 3:52:55 AM1/15/02
to
Hi,

oh, I just had this in my mind - seems like I mixed it with limitations of
some other control (combo box?). Thanks for correcting me.

Regards,

Mathias Wuehrmann

"MikeD" <nob...@nowhere.edu> schrieb im Newsbeitrag
news:#nrTbuVnBHA.2488@tkmsftngp03...

0 new messages