PRB: DisplayValue of ComboBox is Truncated in a Grid

Last reviewed: January 10, 1997
Article ID: Q156771
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows 5.0

SYMPTOMS

When a ComboBox is placed in a grid, the DisplayValue of the ComboBox appears truncated.

CAUSE

The DisplayValue is longer than the field to which the column is bound.

WORKAROUND

Set the InputMask property of the Column to the length needed for the DisplayValue.

STATUS

This behavior is by design.

MORE INFORMATION

The default InputMask used by the Column is calculated based on the field to which the column is bound (the ControlSource).

Steps to Reproduce Behavior

This example will use the Customer table in the Visual FoxPro\SAMPLES\DATA directory.

  1. Create a new form.

  2. Add the Customer table of TESTDATA to the Data Environment.

  3. Add a grid to the form, and set the following properties for the grid:

    ColumnCount = 3 RecordSource = Customer RowHeight = 25

  4. Set the ControlSource property for Column1 of the grid to customer.cust_id.

  5. Set the ControlSource property for Column3 of the grid to customer.company.

  6. Add a ComboBox to Column2 of the grid and set the following properties of the ComboBox:

    BoundColumn = 2 ColumnCount = 2 ColumnWidths = 75,0 Name = Combo1 RowSource = customer.company, cust_id RowSourceType = 6 - Fields

  7. Set the following properties for Column2 of the grid:

    ControlSource = customer.cust_id CurrentControl = Combo1 Sparse = .F. - False

  8. Save and run the form.

  9. Click the down arrow for the ComboBox on one of the records. Note that the DisplayValue (the company field) becomes truncated (to five characters).If you scroll in the grid, you will notice that the DisplayValues for the other rows in the grid also become truncated.

To work around the problem, change the InputMask of the column to match the length of the field you are trying to display in the ComboBox. For the example above, set the InputMask of Column2 to:

   = REPLICATE("X", 40)


KBCategory: kbprg kbprb
KBSubcategory: FxprgGrid
Additional reference words: 5.00 VFoxWin kbdsd



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: January 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.