各位老师请教一下

liuer 2002-08-18 11:48:47
unit Unit1;

interface

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

type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button2: TButton;
Button1: TButton;



score=1..100;
pgrade=^grade;
grade=record
number :integer;
name :string[20];
maths :score;
chinese:score;
english:score;
end;
private
{ Private declarations }
public
{ Public declarations }
end;



第一段是自动生成的,第二段是我自己申明的子界类型和记录指针类型,可调试时老是在score=1..100处说"Expected :but = found",而在控制台程序里却能通过,不知这是为什么啊?我是新手,老师们帮帮我啊
...全文
39 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuer 2002-08-19
  • 打赏
  • 举报
回复
果然行了,为什么要放在前面啊?
liuer 2002-08-19
  • 打赏
  • 举报
回复
如果非要把自己定义的类型写在下面,再用一个type就可以了?或者只能写在前面?谢谢
del_c_sharp 2002-08-19
  • 打赏
  • 举报
回复

TForm1 = class(TForm)
StringGrid1: TStringGrid;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button2: TButton;
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;

上面的部分是窗体类的定义的.里面是类的方法函数和属性以及成员变量

下面是你自己的类型定义,与窗体类没有直接关系,两个不能交叉
type
score=1..100;
pgrade=^grade;
grade=record
number :integer;
name :string[20];
maths :score;
chinese:score;
english:score;
end;
chechy 2002-08-18
  • 打赏
  • 举报
回复
try this:
unit Unit1;

interface

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

type
score=1..100;
pgrade=^grade;
grade=record
number :integer;
name :string[20];
maths :score;
chinese:score;
english:score;
end;

TForm1 = class(TForm)
StringGrid1: TStringGrid;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button2: TButton;
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧