unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
const
  FilePath = 'c:\temp\Test.txt';
var
  List: TStringList;
begin
  List := TStringList.Create;
  List.Sorted := True;
  List.Duplicates := dupIgnore;
  List.LoadFromFile(FilePath);
  ListBox1.Items.Assign(List);
  List.Free;
end;

end.

posted on 2009-02-22 21:20  万一  阅读(2993)  评论(4编辑  收藏  举报