Re: Listbox+files.txt+memo


Posted by Ulrich Becker on November 15, 2000 at 15:10:55:

In Reply to: Listbox+files.txt+memo posted by Denis on November 15, 2000 at 14:02:18:

procedure TForm1.lstBoxClick(Sender: TObject);
var 
  i : Integer;
  s : String;
  tf : Textfile; 
begin
  s := '';
  for i := 0 to pred(lstBox.Items.Count) do
    begin
    if lstBox.Selected[i] then
      s := lstBox.Items[i];
    end;
  if s <> '' then
    begin
    s := 'c:\' + s;
    memo1.Lines.Clear;
    assignFile (tf,s);
    reset (tf);
    while not eof(tf) do
      begin
      readln (tf,s);
      memo1.Lines.Add (s);
    end;
    closeFile (tf);
  end;
end;


Related Articles and Replies: