Share via


Fill a List with Values from Different Sources

File: ...\Samples\Solution\Controls\Lists\Multdat1.scx

This sample demonstrates setting the RowSourceType of a list box at run time to a value, an alias, a SQL statement, a query (.qpr), an array, fields in a table, files in a directory, and the structure of a table.

The combo box on the form contains all the possible RowSourceTypes of a list (except for 9 - popup, which is included for backward compatibility). The code associated with the InteractiveChange event sets the new RowSourceType and RowSource properties for the list.

When you change both the RowSourceType and RowSource of a list box at run time, you need to do the following:

  1. Set the RowSourceType to 0.
  2. Set the RowSource to the new source.
  3. Set the RowSourceType to the new type.

If you don't follow this order, the existing RowSource and RowSourceType settings could conflict after one new value is set and before the corresponding value is set.

See Also

Solutions Samples | Visual FoxPro Foundation Classes A-Z