存取 ListBox 列表 - 回复 "徐强" 的问题

问题来源: 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.

 
 
 
 
 

 

 
  

你可能感兴趣的:(存取 ListBox 列表 - 回复 "徐强" 的问题)