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 :_)
kevinp
05-12-2010, 03:55 PM
Hi
Excellent script. Is there a way to make the results selectable. What I mean is when the results of the selected file are shown in the ListBox each one will open an assigned file or url when clicked.
I tried using pipe (|) in the file then the file address e.g.
Burnaby|http://www.lancashire.gov.uk/environment/documents/transport/134.pdf
but this just shows as part of the text in the list box instead of becomming 'Item Data'.
This function would make this example perfect for many uses.
Any ideas appreciated
Thanks for the ListBox_Province_City_Select_6.0.0.0.apz its come in handy
Rhys
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.