问题来源: http://www.cnblogs.com/del/archive/2008/12/05/1022130.html#1392641

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

const s = 'c:\temp\test.txt';

procedure TForm1.Button1Click(Sender: TObject);
begin
  ListBox1.Items.CommaText := '万一,Delphi,博客';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ListBox1.Items.SaveToFile(s);
  ListBox1.Clear;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  ListBox1.Items.LoadFromFile(s);
end;

end.

posted on 2008-12-05 21:12  万一  阅读(2926)  评论(10编辑  收藏  举报