我想实现把Edit1中的文本增加到ListBox1中,
在把Edit1中的文本清空!
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Add(Edit1.text);Edit1.Text:= '';
end;
[Error] Unit1.pas(36): Declaration expected but end of file found
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'

不能在'Unit1.pas'单元中找到是什么意思?

解决方案 »

  1.   

    少了一个 end  具体哪里少了,需要贴全代码
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Button1: TButton;
        ListBox1: TListBox;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
    ListBox1.Items.Add(Edit1.text);Edit1.Text:= '';
    end;
      

  3.   


    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ListBox1.Items.Add(Edit1.text);Edit1.Text:= '';
    end;
    end.
      

  4.   

    谢谢大家  问题解决了,怎么给大家加分呢?
    麻烦大家帮我看下,我还有一个问题没有解决:
    http://topic.csdn.net/u/20101222/17/93416e37-70eb-4912-9eb6-ade54ac7b2d6.html?91497
      

  5.   


    在本页面点击结贴。
    http://topic.csdn.net/u/20101222/17/93416e37-70eb-4912-9eb6-ade54ac7b2d6.html?91497
    你这个问题二楼大牛已经完美回答你了if OpenDialog1.Execute then  Memo1.Lines.Add(OpenDialog1.FileName);