PDA

View Full Version : EXAMPLE: Dynamically Populate ListBoxes


Desmond
09-30-2005, 11:07 AM
Hello,

This example demonstrates how to dynamically insert items into ListBox objects. In this project there are two listbox objects. The first (province) is populated based on files located inside a specific directory. When an item is selected in the province listbox, the second listbox (city) is populated based on the contents of a specific file in the same directory.

Skills Used: File.Find, Read Text File To Table, ListBox Object, Dynamically add Items, Object Interaction.

Phil Merry
10-04-2006, 04:49 AM
Desmond

I am writting an application that utilises your apz for dynamically updating list boxes, I can obviously change the data pre build and it works fine, but I need to point to an external 'list' that is in constant change.

A bit on the thick side, but how can I modify your script to point to an external file that may be on a usb drive?

The file names will remain the same on all users but the data content will be diiffent.

Best Regards

Phil Merry

Desmond
10-04-2006, 10:15 AM
Hello,

The cities for each province are loaded from seperate text files for each province through this action:
tProvinceFiles = File.Find(_SourceFolder .. "\\AutoPlay\\Docs\\Provinces", "*.txt", false, false, nil, nil);

You could change
_SourceFolder .. "\\AutoPlay\\Docs\\Provinces"

To point to another folder outside of your application, for example:
_SourceDrive .. "\\YourFolderHere"

Desmond.

Mathew202
11-25-2006, 02:27 AM
Hi, is there any way to modify this so it looks at default folder (providence) then instead of looking at text documents it looks at folders,

once selectd folder was selected for file list it would then display another list of txt files, when one of them was elected it would appear as a link at the bottom or in a new window ?

many thanks :_)