Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Controls / July 2008



Tip: Looking for answers? Try searching our database.

Listbox Limits?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Zero - 17 Jul 2008 16:13 GMT
Hi folks,

I'm dealing with Visual Basic 6.0 and want to know what's the limit to the
total number of items (ie. total rows) that the 16-bit listbox control can
store? I've heard some conflicting answers (65535, 32768, 32767, and even
just 65535 total storage bytes - meaning that you're only able to store that
many characters in the entire listbox) so figured it was time to post.

Does anyone know a definitive answer on this question?

 -Zero
Jan Hyde (VB MVP) - 17 Jul 2008 17:15 GMT
Zero <Zero@discussions.microsoft.com>'s wild thoughts were
released on Thu, 17 Jul 2008 08:13:02 -0700 bearing the
following fruit:

>Hi folks,
>
[quoted text clipped - 5 lines]
>
>Does anyone know a definitive answer on this question?

The definitive answer is WAY more than you should ever put
in a listbox.

I'm serious. Having to scroll through thousands of entries!

--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
Jeff Johnson - 17 Jul 2008 18:53 GMT
> I'm dealing with Visual Basic 6.0 and want to know what's the limit to the
> total number of items (ie. total rows) that the 16-bit listbox control can
[quoted text clipped - 4 lines]
>
> Does anyone know a definitive answer on this question?

Unless you're trying to win a bar bet the answer is "It doesn't matter,
because you should never put anywhere near the amount of items in a list box
that are actually allowed."

The one about bytes is completely wrong, however.

You know, you could write a REALLY quick test program to find the answer....

(But I have to wonder: what exactly do you mean by "16-bit listbox
control"?)
Ed - 18 Jul 2008 04:37 GMT
>Hi folks,
>
[quoted text clipped - 7 lines]
>
>  -Zero

List box and combo box controls
Maximum number of items is 32K
the limit on the size of each item is 1K (1024 bytes).

http://msdn.microsoft.com/en-us/library/aa240865(VS.60).aspx
Lorin - 20 Jul 2008 19:05 GMT
LONGs worth if you use SendMessage
Other SendMessages operations do the other Box operations too.

sample for retrieving given the index is
Public Function BoxTextGet(oObj As Object, lIndex As Long) As String

   Dim lParam1 As Long
   Dim lParam2 As Long
   Dim lLen As Long
   Dim sTxt As String

   ' get length
   Select Case UCase$(TypeName(oObj))
   Case "LISTBOX"
       ' retreive form the list of a ListBox
       lParam1 = LB_GETTEXTLEN
       lParam2 = LB_GETTEXT

   Case "COMBOBOX"
       ' retreive form the list of a ComboBox
       lParam1 = CB_GETLBTEXTLEN
       lParam2 = CB_GETLBTEXT

   Case Else
       Exit Function

   End Select

   lLen = SendMessage(oObj.hwnd, lParam1, lIndex, -1)

   If lLen > 0 Then
       ' get text
       sTxt = Space$(lLen)
       SendMessage oObj.hwnd, lParam2, lIndex, ByVal sTxt
   End If

   BoxTextGet = sTxt

End Function 'BoxTextGet

> Hi folks,
>
[quoted text clipped - 8 lines]
>
>  -Zero
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.