мой код программы продолжает давать проблемы при компиляции. Идея программы состоит в том, чтобы создать процедуру, которая будет читать текстовые файлы в массиве. Затем кнопка отобразит их на richedit.Недопустимый тип-тип в процедуре
Вот исходный код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
ArrNames = array [1..10] of string;
ArrSales = array [1..10] of integer;
type
TForm1 = class(TForm)
btnShowData: TButton;
redt1: TRichEdit;
procedure btnShowDataClick(Sender: TObject);
private
public
{ Public declarations }
end;
Procedure Showdata;
var
Form1: TForm1;
implementation
{$R *.dfm}
Procedure ShowData;
var c2u : textfile;
count : integer;
aNames : arrNames;
aSales : arrSales;
Begin
If FileExists('data.txt') <> true then
begin
Messagedlg('File does not exist', mtError, [mbOK], 0);
Exit;
end;
Count :=0;
AssignFile(c2u, 'data.txt');
Reset(c2u);
While Not EOF(c2u) do
begin
Inc(Count);
readln (c2u, aNames[count]);
readln (c2u, aSales[count]);
end;
Closefile(c2u);
End;
procedure TForm1.btnShowDataClick(Sender: TObject);
var J : integer;
aNames : arrNames;
aSales : arrSales;
begin
redt1.lines.add(aNames[J] +#9 + 'R' +IntToStr(aSales[J]));
end;
end.
Есть ли причина, по которой вы не используете TStringList - способ «Delphi» для этого? –
Что такое * точная ошибка сообщения, которое вы получаете? –
Ник прав об использовании TStringList. Кроме того, вы не показали нам, что определяется как «ArrNames». Зная, что это поможет. –