随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253


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  万一  阅读(...)  评论(...编辑  收藏