KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q139049: How to Make Combo or List Boxes Hold More than 255 Characters

Article: Q139049
Product(s): Microsoft FoxPro
Version(s): WINDOWS:3.0
Operating System(s): 
Keyword(s): kbcode
Last Modified: 11-FEB-2000

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, version 3.0 
-------------------------------------------------------------------------------

SUMMARY
=======

When you use a list or combo box that has Value as the RowSourceType, only 255
characters can be typed into the RowSource property. You should use the Value
option in the RowSourceType property when you need to place static values in the
list or combo box. When you choose the Value option, the values can be typed
into the RowSource property separated by commas. Once 255 characters have been
typed into the RowSource property, no more characters are allowed, so the
computer's bell sounds when you try to add another character. If the list or
combo box needs to hold more than 255 characters, create an array to hold the
values as demonstrated by the example in this article.

MORE INFORMATION
================

Step-by-Step Example
--------------------

1. Create a form in Visual FoxPro.

2. On the Form menu, click New Property. In the Name box, type:

     listarray(5)

3. In the Load event, type:

     THISFORM.LISTARRAY(1)="Choice1"
     THISFORM.LISTARRAY(2)="Choice2"
     THISFORM.LISTARRAY(3)="Choice3"
     THISFORM.LISTARRAY(4)="Choice4"
     THISFORM.LISTARRAY(5)="Choice5"

4. Select a list or combo box from the Controls toolbar, and place it on the
  form.

5. Choose the RowSourceType property of the list or combobox in the Properties
  Sheet, and select the Array option.

6. In the RowSource property, type:

     thisform.listarray

7. In the NumberOfElements property, type:

     =ALEN(thisform.listarray)

8. Run the form, and note that the list or combo box contains the elements of
  the array.

This is a small example demonstrating the kind of elements an array might hold.
The only limitation is that the array can hold a maximum of 65000 elements.

Additional query words: VFoxWin

======================================================================
Keywords          : kbcode 
Technology        : kbVFPsearch kbAudDeveloper kbVFP300
Version           : WINDOWS:3.0

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.