unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids;type
MethodFileType = file of TMethod;
TRecFileForm = class(TForm)
OpenButton: TButton;
NewButton: TButton;
CloseButton: TButton;
ExitButton: TButton;
AddButton: TButton;
ModifyButton: TButton;
DeleteButton: TButton;
CalcuButton: TButton;
Label1: TLabel;
Label2: TLabel;
StringGrid1: TStringGrid;
LabeledEdit1: TLabeledEdit;
OpenDialog1: TOpenDialog;
procedure OpenButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
RecFileForm: TRecFileForm;
FileName:string[70];
MethodFile:MethodFileType;
Count:integer;
FileOpened:Boolean;
implementation{$R *.dfm}procedure TRecFileForm.OpenButtonClick(Sender: TObject);
begin
if OpenDialog1.Execute then
FileName:=OpenDialog1.FileName
else
exit;
AssignFile(MethodFile,Filename);
try
Reset(MethodFile);
FileOpened:=True;
except
On EInOutError do
begin
try
if FileExists(FileName)=False then
begin
ReWrite(MethodFile);
FileOpened:=True;
end
else
begin
FileOpened:=False;
MessageDlg('文件不能打开',mtWarning,[mbOK],0);
end;
except
On EInOutError do
begin
FileOpened:=False;
MessageDlg('文件不能创建',mtWarning,[mbOK],0);
end;
end;
end;
end;
if FileOpened=False then exit;
Count:=FileSize(MethodFile);
if Count>0 then ChangGrid;//出错//
RecFileForm.Caption:=FormCaption+' -- '+FileName;//出错//
NewButton.Enabled:=False;
OpenButton.Enabled:=False;
CloseButton.Enabled:=True;
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids;type
MethodFileType = file of TMethod;
TRecFileForm = class(TForm)
OpenButton: TButton;
NewButton: TButton;
CloseButton: TButton;
ExitButton: TButton;
AddButton: TButton;
ModifyButton: TButton;
DeleteButton: TButton;
CalcuButton: TButton;
Label1: TLabel;
Label2: TLabel;
StringGrid1: TStringGrid;
LabeledEdit1: TLabeledEdit;
OpenDialog1: TOpenDialog;
procedure OpenButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
RecFileForm: TRecFileForm;
FileName:string[70];
MethodFile:MethodFileType;
Count:integer;
FileOpened:Boolean;
implementation{$R *.dfm}procedure TRecFileForm.OpenButtonClick(Sender: TObject);
begin
if OpenDialog1.Execute then
FileName:=OpenDialog1.FileName
else
exit;
AssignFile(MethodFile,Filename);
try
Reset(MethodFile);
FileOpened:=True;
except
On EInOutError do
begin
try
if FileExists(FileName)=False then
begin
ReWrite(MethodFile);
FileOpened:=True;
end
else
begin
FileOpened:=False;
MessageDlg('文件不能打开',mtWarning,[mbOK],0);
end;
except
On EInOutError do
begin
FileOpened:=False;
MessageDlg('文件不能创建',mtWarning,[mbOK],0);
end;
end;
end;
end;
if FileOpened=False then exit;
Count:=FileSize(MethodFile);
if Count>0 then ChangGrid;//出错//
RecFileForm.Caption:=FormCaption+' -- '+FileName;//出错//
NewButton.Enabled:=False;
OpenButton.Enabled:=False;
CloseButton.Enabled:=True;
end;end.
RecFileForm.Caption:=FormCaption+' -- '+FileName;//出错//
ChangGrid;//出错// 是你自己定义的过程吧,定义过程也不能随便哦Type区:
procedure ChangGrid();
implementation:
procedure TForm1.ChangGrid(); //要加类名