procedure TForm1.Button1Click(Sender: TObject);
type
Tvowels=set of Char;
var
Vowels:Tvowels;
Vowels:=['a','e','i','o','u'];
if Edit1.text[1] in Vowels then
Label1.caption:='OK';
else
Label1.caption:='不OK';
end;
运行后报错如下:
[Error] Unit1.pas(33): Identifier redeclared: 'Vowels'
[Error] Unit1.pas(33): Identifier expected but string constant found
[Error] Unit1.pas(34): ',' or ':' expected but '.' found
[Error] Unit1.pas(34): Constant expression expected
[Error] Unit1.pas(35): ',' or ':' expected but '.' found
[Error] Unit1.pas(37): Identifier redeclared: 'Label1'
[Error] Unit1.pas(37): ',' or ':' expected but ':=' found
[Error] Unit1.pas(39): Type expected but 'END' found
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
type
Tvowels=set of Char;
var
Vowels:Tvowels;
Vowels:=['a','e','i','o','u'];
if Edit1.text[1] in Vowels then
Label1.caption:='OK';
else
Label1.caption:='不OK';
end;
运行后报错如下:
[Error] Unit1.pas(33): Identifier redeclared: 'Vowels'
[Error] Unit1.pas(33): Identifier expected but string constant found
[Error] Unit1.pas(34): ',' or ':' expected but '.' found
[Error] Unit1.pas(34): Constant expression expected
[Error] Unit1.pas(35): ',' or ':' expected but '.' found
[Error] Unit1.pas(37): Identifier redeclared: 'Label1'
[Error] Unit1.pas(37): ',' or ':' expected but ':=' found
[Error] Unit1.pas(39): Type expected but 'END' found
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
解决方案 »
- 如何使edit每隔5秒显示memo中的一行??
- 《Delphi5开发人员指南》--有传说中的那么好吗?
- 在RAVE 报表中,如何让为0的字段显示为空???
- IdUdpServer端口设置的问题,第一次成功,第二次有问题!
- 三层结构的客户端,在win98,win2000,下正常运行,但在winxp下报错:load midas.dll error!!!
- 汗呀~~~ 我以为我以经很不要FS了,但没想到........
- 第41题):win2000系统日志问题?
- 高分求助,有没有人见过一个叫TTF160_TLB的pas或dcu文件?在哪儿可以找到
- 数字精度的问题!!!
- 客房管理软件 怎么动态生成 台面
- 推荐几个学习Delphi的好站
- 在线等待:求援!请大家帮忙!!!QQQ
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
Tvowels=set of Char; <-定义要在这
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
Vowels:Tvowels;
begin
Vowels:=['a','e','i','o','u'];
if Edit1.text[1] in Vowels then
Label1.caption:='OK' <-else前不应该加分号
else
Label1.caption:='不OK';
end;end.
type
Tvowels=set of Char;
var
Vowels:Tvowels;
begin
Vowels:=['a','e','i','o','u'];
if Edit1.text[1] in Vowels then
Label1.caption:='OK'
else
Label1.caption:='不OK';
end;