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.

解决方案 »

  1.   

    ChangGrid;//出错//
    RecFileForm.Caption:=FormCaption+' -- '+FileName;//出错//
      

  2.   

    FormCaption====>Form1.Caption
    ChangGrid;//出错// 是你自己定义的过程吧,定义过程也不能随便哦Type区:
     procedure ChangGrid();
    implementation:
     procedure TForm1.ChangGrid(); //要加类名
      

  3.   

    knock(天天睡觉)我做的是记录文件打开和创建里的‘打开BUTTON’,我刚学DELPHI不知道这个过程是干什么的。帮我写一下好吗??