The information in this article applies to:
- Microsoft Visual FoxPro for Windows, version 3.0
- Microsoft Visual FoxPro for Macintosh, version 3.0b
SUMMARY
It is possible to use a combo box in Visual FoxPro to filter the contents
of a grid by using the value property of the combo box.
MORE INFORMATION
To filter out certain records within a table, use the SET FILTER command
along with the value property of the combo box.
Step-by-Step Example
- Create a form by using the CREATE FORM <form name> command.
- Open the Testdata.dbc database in the VFP\Samples\Data directory. Add
the Customer table to the data environment. Drag the Customer table from
the data environment onto the form to create a grid.
- Add a combo box to the form from the controls toolbar, and in the Name
property, type:
cboTest
- In the RowSource property of the combo box, type some data that you know
is in the table, separating each of the values with commas. For example,
type:
Germany,France,Spain
- For the RowSourceType property, select Value.
- In the Click event of the combo box, type this code:
SELECT Customer
SET FILTER TO Country = Thisform.cboTest.Value
Thisform.Refresh()
- Save and Run the form. When you selecting one of the items in the
combo box, the grid reflects only those records that pertain to that
item.
|