delphi菜鸟请教
这个程序的操作为:在form1窗体中分别添加listbox,memo,edit,button,然后双击button空间在弹出的代码编辑器中输入程序,最终在memo控件中显示用户在listbox中选定的项目。但是总是有错误,请高手指点一下。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add(Edit1.Text);
If ListBox1.ItemIndex>=0
Then Memo1.Lines.Add(ListBox1.Items[ListBox1.ItemIndex])
end;
end.