jsherk
Posts: 34
|
| Posted: 01/25/2009, 6:52 AM |
|
I have a listbox on a Record form and I need to populate the listbox choices with an array that looks something like this:
$countries['US'] = 'United States';
$countries['CA'] = 'Canada';
$countries['MX'] = 'Mexico';
Reading the help docs, it appears that I might want to set the Listbox Data Source Type to Procedure, but when I click on the little dropdown arrow for this property, I only get Table/View, SQL, & List Of Values... there is no option for Procedure.
Is there something else I need to set first, or is there just another way I should be doing this?
Any help would be appreciated... thanks.
|
 |
 |
datadoit
|
| Posted: 01/25/2009, 8:13 AM |
|
Start here: http://docs.codecharge.com/studio40/html/ProgrammingTec...Values.html?toc
More detailed sample of populating your array from a data table here: http://forums.codecharge.com/posts.php?post_id=102308
|
|
|
 |
jsherk
Posts: 34
|
| Posted: 01/25/2009, 9:18 AM |
|
Thanks datadoit... that worked perfect!!
For the sake of anybody else reading this, here is my solution:
I have a Form named NewAccountData, and a Listbox in that form named ListBox11. I have a custom function that retrieves a list of countries from a file located elsewhere. I then set the Listbox Data Source Type Property to ListOfValues, and then add the following custom code in the BeforeShow Event of the Listbox:
$countries_full = get_list_of_countries();
//The above custom function (get_list_of_countries) retrieves a
// list of countries in the following format:
// $countries_full['US'] = 'United States'
// $countries_full['CA'] = 'Canada'
// $countries_full['MX'] = 'Mexico'
$countries_list = array();
foreach ($countries_full as $country_key => $country_option) {
$countries_list []= array($country_key, $country_option);
}
$NewAccountData->ListBox11->Values = $countries_list;
That's it!!
|
 |
 |
|