Microsoft KB Archive/121723

= How to Display Any Column of an Array in a List or Popup =

Article ID: 121723

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.6 for SCO/UNIX

-



This article was previously published under Q121723



SUMMARY
By default, a list or popup shows the information from the first column of a multiple-column array. The methods below describe how to display information from any of the columns.



Visual FoxPro
 Create a form with a ListBox in it.  Add the following code to the Init event of the ListBox: PUBLIC ARRAY test(1,2) * Define the two column array SELECT cust_id, company FROM customer INTO ARRAY test THIS.RowSource='test' && Ties the ListBox to the array THIS.RowSourceType=5 && Tells the ListBox what type of data its using THIS.ColumnCount=2  && In order to get other columns to show, you && must have a column count greater than 1 THIS.BoundColumn=2 THIS.ColumnWidths= '0,' +STR(THIS.Width) && Setting the ColumnWidth && property to 0, is the key to                        && displaying the second column. 

FoxPro 2.x
NOTE: This example assumes that the CUSTOMER.DBF table has been installed in FoxPro's TUTORIAL subdirectory.

To display any column of an array in a list or popup, use the Screen Builder to perform the following:

  In the Setup Code snippet of a test screen, type the following: SET DEFAULT to \tutorial SELECT company, city, state FROM customer INTO ARRAY a3colmns  Create a list or popup object. For a list, select the From Array radio button. For a popup, select the Array Popup radio option button. Type A3COLMNS in the Array Popup text box.</li> In the Variable text box, type "M.COL" (without the quotation marks).</li> Choose 1st Element.</li> Verify that the Expression radio button is selected. Then type the number 1, 2, or 3 in the text editing region. The number you type designates which of the three array columns will be displayed.</li> Generate and run the screen.</li></ol>

NOTE: The first column of the array contains COMPANY field data, the second contains CITY field data, and the third contains STATE field data from the CUSTOMER.DBF table.

Additional query words: FoxUnix FoxMac FoxDos FoxWin VFoxWin 2.50 2.50a 2.50b 2.50c 2.60a different other many specific only multicolumn multi-column multi-dimension multiple-dimension dimension genscrn.prg power tool

Keywords: kbcode KB121723

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.