PDA

View Full Version : DB and ListBox problem...


crustyDOD
06-19-2001, 07:53 AM
Hi

I have a DB connected through Table component
and now I want each word from one field in DB
to be shown in list box. It looks like this...

DB:
Field1 | Field2
1as 2as 3as 4as... | Empty

Now I want each word (1as 2as 3as...) to be shown
in each line of ListBox1 like this:
1as
2as
3as...

Can someone solve this?

thx

CrustyDOD

LörAn
06-19-2001, 10:27 PM
Try this :

procedure AddFieldValues();
var
vlText: TStringList;
begin
vlText := TStringList.Create();
vlText.Text := StringReplace(Table1.FieldByName('Field1').asStrin g, ' ', #13+#10, [rfReplaceAll]);
ListBox1.Items.AddStrings(vlText);
end;

Maybe there's a simpler way, but this seems to work fine.

LörAn.