Discussion:
Read Files of Directory in PBWIN 6/7/8
(too old to reply)
Alen Hopek
2006-01-10 23:52:31 UTC
Permalink
Hallo,

i?m searching for a easy way to read all files of a directory and show
them in a listbox.

I get on display some entries but the first 7-8 of the listbox are empty
the rest shows me some filenames. What can be wrong ?

Or has somebody a better idea ? Here is my Code:

LOCAL a AS STRING
LOCAL x AS INTEGER

DIM Listing(1 TO 1000) AS STRING

a = DIR$("C:\*.*")

FOR x = 1 TO LEN(a)
LISTBOX ADD hDlg, lID, a
a = DIR$
NEXT x

Thanx for Ideas

Greetings
Alen
changling
2006-01-11 11:07:14 UTC
Permalink
Post by Alen Hopek
Hallo,
i?m searching for a easy way to read all files of a directory and show
them in a listbox.
I get on display some entries but the first 7-8 of the listbox are empty
the rest shows me some filenames. What can be wrong ?
LOCAL a AS STRING
LOCAL x AS INTEGER
DIM Listing(1 TO 1000) AS STRING
a = DIR$("C:\*.*")
FOR x = 1 TO LEN(a)
LISTBOX ADD hDlg, lID, a
a = DIR$
NEXT x
Thanx for Ideas
Greetings
Alen
a = DIR$("C:\*.*")
DO
LISTBOX ADD hDlg, lID, a
a = DIR$
LOOP UNTIL a = ""
Alen Hopek
2006-01-11 14:02:15 UTC
Permalink
Hello,

thank you for help that works !

Greetings
Alen
Post by Alen Hopek
a = DIR$("C:\*.*")
DO
LISTBOX ADD hDlg, lID, a
a = DIR$
LOOP UNTIL a = ""
Peter Manders
2006-01-11 14:06:59 UTC
Permalink
Post by Alen Hopek
a = DIR$("C:\*.*")
DO
LISTBOX ADD hDlg, lID, a
a = DIR$
LOOP UNTIL a = ""
That'll work, but:

LOOP UNTIL LEN(a) = 0

is slightly faster, and a bit more logical to me.
--
Peter Manders.

Post may contain irony: discontinue use if experiencing mood swings,
nausea or elevated blood pressure.
Loading...