读书人

请问delphi程序有关问题

发布时间: 2013-08-09 15:16:24 作者: rapoo

请教,delphi程序问题。
unit Unit1;

interface

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

type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
count1:Integer;
// a,b,c:Integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
count1:=count1+1;
if (count1 mod 2=1) then
ListBox1.Items.Add('HELLO WORLD!');
else
ListBox1.Items.Add('HELLO FRIEND!');
end;

end.
后面的判断,我分别注释后都能显示出来,但是放一起就会报错。请问原因。
[解决办法]
sololie 大哥说得对 还有 if (count1 mod 2=1) then 最好写成if (count1 mod 2)= 1 then

读书人网 >.NET

热点推荐