Delphi E2029:需要声明但找到了文件结尾-如何调试?

问题描述 投票:0回答:1

大家好,我出现了一个错误并且无法摆脱。.

我在自己的delphi代码中添加了2个自定义过程,我听说您可以按crtl+shift+c自动生成函数,就像我所做的那样。

但是现在我的问题是我不需要自动生成的东西,这就是为什么我在执行命令后将其删除了。现在,由于出现此错误,我的代码不再起作用:

E2029需要声明,但找到文件末尾

预期初始化,但在第520(520:1)行收到文件结尾

如何修复我的代码?删除或在文件末尾添加“ end”对我没有帮助。有没有办法找出我的代码中缺少的地方? (我可以发布我的delphi代码,但是它的500行长,我认为这没有道理。

更新代码:

unit Benutzerverwaltung_U;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.ComCtrls,
  Vcl.StdCtrls,
  Vcl.WinXCtrls, Vcl.CheckLst, System.Actions, Vcl.ActnList, Vcl.Menus,
  System.StrUtils,
  Data.DB, Vcl.Grids, Vcl.DBGrids, Vcl.DBCtrls, FireDAC.Stan.Intf,
  FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS,
  FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Comp.DataSet,
  FireDAC.Comp.Client;

type
  TForm1 = class(TForm)

其他按钮等...

    procedure SwapValues(var Zahl1, Zahl2: Integer); //new
    procedure SelectionSort(Sender: TObject);  // new
    procedure Button11Click(Sender: TObject); //new

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }

    workerModel: record
      VorName: string[40];
      NachName: string[40];
      Age: Integer;
      Schließen: string[30];
      Admin: TToggleSwitchState;
      DatenSehen: TToggleSwitchState;
      Gender: string[20];

    end;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Sonderrechte_U, CheckedItem_U, Unit1, BenutzerEdit_u;


procedure TForm1.SwapValues(var Zahl1, Zahl2: Integer);
var
  h: Integer;
begin
  h := Zahl1;
  Zahl1 := Zahl2;
  Zahl2 := h;
end;

procedure TForm1.SelectionSort(Sender: TObject);
var
  i, j, min: Integer;
var
  sortArray, Data: Array of string;

begin

  for i := 1 to Form1.ListBox1.Items.Count - 1 do
  // i muss wahrscheinlich 0 sein?
  begin
    min := i;
    for j := i + 1 to Form1.ListBox1.Items.Count do
      if (Data[j] < Data[min]) then
        min := j;
    SwapValues(i, min);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(Self);
  try
    Form2.ShowModal;
  finally
    Form2.Free;
  end;

end;

//更多代码

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
  l: Integer;
  t: String;
begin
  with ListBox1 do
  begin
    Canvas.FillRect(Rect);
    t := Items[Index];
    l := Rect.Right - Canvas.TextWidth(t) - 1;
    Canvas.TextOut(l, Rect.Top, t);
  end;
end;

procedure TForm1.SearchBox1Change(Sender: TObject);

var
  i: Integer;

begin
  // SearchBox1.Parent := ListBox1;

  ListBox1.Items.BeginUpdate;

  try
    for i := 0 to ListBox1.Items.Count - 1 do
      ListBox1.Selected[i] := ContainsText(ListBox1.Items[i], SearchBox1.Text);

  finally
    ListBox1.Items.EndUpdate;


end;
// end;


// this is the end of the file
delphi vlc pascal
1个回答
1
投票

Delphi单元必须以]结尾>

end.

(注意句号)。>

© www.soinside.com 2019 - 2024. All rights reserved.