Click to See Complete Forum and Search --> : listcount property


deane
June 2nd, 1999, 01:38 PM
It appears as though the listcount property of a listbox is limited to an integer number. Is there a way to set the listcount property to return a longint value?

EFD

Ravi Kiran
June 2nd, 1999, 11:13 PM
Hi,

Do you just want : "the listcount property to return a longint value?", then you can use 'type cast' function Clng, like
clng(list1.listcount)

But, if you really have > 32767 no. of elements,
it is not possible to add that many, in the first place. i.e a code like

dim i as long
for i = 1 to 32768
List1.AddItem "item:" & format(i)
next i




gives run time error 5, "Invalid procedure call".
( A bug?!, shouldn't it give Err No 6: Overflow?!!) when i = 32768. This code runs fine if the outer limit is 32767.

Designers of VB must have thought, for sizes that big, it warrents a seperate handling!! You can maintain yourown list of strings and display only a portion of them!!

Ravi