首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

请问,delphi程序有关问题

2013-08-09 
请教,delphi程序问题。unit Unit1interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphic

请教,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

热点排行