Page 1 of 1

List in a listbox all item from a dbf file

PostPosted: Fri Aug 15, 2008 6:55 am
by Alex
Hi,

How can I list in a listbox all item from a table from a DBF file?

For example, in the table Name, how can I get all the name to a listbox?

Thanks


Alex

PostPosted: Fri Aug 15, 2008 7:28 am
by Wrangler
Yup. Get help and copy and paste.

Alex, try reading the help file before you post questions. Everything you need to know on how to do this is in the help files. Then if you have problems while coding this, post your code here.

PostPosted: Fri Aug 15, 2008 7:33 am
by Alex
Hi Wrangler,

It is not writen in the help or I don't know where it is.

Thanks


Alex

PostPosted: Fri Aug 15, 2008 7:41 am
by Wrangler
How to get table names, and how to populate a list box is not in the help file? Apparently you aren't spending much time reading it. If you can't find it, look harder.

TRY AND CODE THIS YOURSELF. IF YOU HAVE PROBLEMS, POST THE CODE HERE. NO ONE HERE IS GOING TO BUILD YOUR APPLICATIONS FOR YOU.

PostPosted: Fri Aug 15, 2008 7:44 am
by dglojnar
You can use command dbffield to var, i think this solve Your problem

PostPosted: Fri Aug 15, 2008 7:45 am
by Alex
Wrangler,

What I trying to do is not to know the table name, but the info what are in the table. For example:

Name (Table Name)
Car
Bus
Computer
TV
...

How can I get the information from the table?

Thanks


Alex

PostPosted: Fri Aug 15, 2008 7:49 am
by Alex
Hi dglojnar,

Excellent, exactly what I search. I didn't know this command. Thanks a lot.


Alex

PostPosted: Fri Aug 15, 2008 7:52 am
by dglojnar
Here is example:

dbfFieldToVar "[database]" "Name" "[data]" ""

where [database] is your dbf database, Name is a field name and [data] is all names from Name field.

After that create listbox and in list box window put variable [data]

Run and that's it.

I hope this help:-)

PostPosted: Fri Aug 15, 2008 8:06 am
by Alex
Hi dglojnar,

Thanks very much, it works as I want.

Thanks


Alex

Re: List in a listbox all item from a dbf file

PostPosted: Sat Dec 29, 2012 9:44 am
by kevinp
That's brilliant. Is it possible to show multiple fields from a DB within a ListBox using this method. e.g.

On page load i have
dbfFieldToVar "C:\Users\admin\Desktop\Neobook\LCCdb\streets.dbf" "STREET" "[street]" ""
dbfFieldToVar "C:\Users\admin\Desktop\Neobook\LCCdb\streets.dbf" "TOWN" "[town]" ""

and I want to show the date in the list box as one line per record e.g.

Street name 1, Town Name2
Street name2 , Town name2

I've tried [street], [town] and also [street][#9][town] but it places each on a seperate line as below

Street name1
Town name1
Street name2
Town name2

I'm sure I'm missing something simple but have become a bit stuck.

Any suggestions would be appeciated

Re: List in a listbox all item from a dbf file

PostPosted: Sat Dec 29, 2012 6:28 pm
by smokinbanger
You can loop through the records in the database adding the street name and city to the list box.
So if record #1 was: Geek Street in Bend
and record 2 was Main St in Vegas
you could end up with a list box like:

Geek Street, Bend
Main St, Vegas

after running your loop sequence