How to Display Concatenated Fields in a Text Box

Last reviewed: November 9, 1995
Article ID: Q138999
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

A text box on a form can display concatenated values from multiple fields. This can be accomplished by putting an expression in the Refresh method of the text box. Both the ControlSource and Value properties of the text box should be left blank and the ReadOnly property should be set to True (.T.).

MORE INFORMATION

Step-by-Step Example

To demonstrate how a text box can display concatenated values, follow these steps:

  1. Create a new form.

  2. Add the Customer table to the Data Environment.

  3. Using the form Controls toolbar, place a text box on the form.

  4. In the text box Refresh method, type the following:

    This.Value = ALLTRIM(Customer.City) + ", " + ;

          ALLTRIM(Customer.Country)
    

  5. Ensure that the text box ControlSource and Value properties are blank. Change the ReadOnly property to True (.T.).

  6. Add a command button to the form, and place the following two lines in its Click event:

    SKIP THISFORM.Refresh

  7. Run the form, and press the command button to observe the values in the text box.


Additional reference words: 3.00 VFoxWin
KBCategory: kbprg kbhowto
KBSubcategory: FxprgGeneral


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.

Last reviewed: November 9, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.