How to Place Values Containing Commas in a Combo Box

ID: Q130544

3.00 WINDOWS

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

Visual FoxPro doesn't allow values containing commas in the RowSource property when creating a list box based on static values because commas are used as separators. This article shows you how to handle values that do contain commas.

MORE INFORMATION

In Visual FoxPro, you can create a combo box or popup list box based on static values by following these steps:

1. Add a Combo box to an existing form.

2. Change the RowSourceType property to 1 - Value.

3. Create a list of items seperated by commas in the RowSource property.

Visual FoxPro treats the RowSource as a text string. It searches for commas, using the items seperated by commas to create a list of items. Therefore, you cannot create values that contain commas.

If you have values that contain commas, base the Combo box on an array that contains the values by following these steps:

1. Add an array called myarray to the form by selecting New Property from

   the Form menu and entering Myarray(1) in the dialog box.

2. In the Load event of the form, redimension and populate the array with
   the values that have embedded commas.

3. Change the RowSource property to the name of the array.

4. Change the RowSourceType property to 5 - Array.

Additional reference words: 3.00 VFoxWin KBCategory: KBSubcategory: FxprgIntl

Keywords          : kbcode FxprgIntl 
Version           : 3.00
Platform          : WINDOWS


Last Reviewed: May 22, 1998
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.