Мб оффтоп, но больше не нашел куда написать.
При запуске программа выдает следующую ошибку:
Проект Project1.exe вызвал исключение класса EAccessViolation с сообщением 'Acceass violation at adres 00404832 in module 'Project1.exe. Read adress 00000000'. Процесс остановленю Используйте Шаг или Запуск для продолжения.
Нажимаю "ОК", и программа запускается.
Указывает на 13 строку:
Код:
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
Далее при попытке выхода из второй формы при помощи своей кнопки выдает ту же ошибку, из формы не выходит, но указывает на "end." в том же коде.
В обработчике обоих событий открытия главной формы и закрытия второй один и тот же код:
Код:
assignfile (townsfile, 'Towns');
assignfile (waysfile, 'Ways');
if not FileExists ('Towns') then
rewrite (townsfile)
else
reset (townsfile);
if not FileExists ('Ways') then
rewrite (waysfile)
else
reset (waysfile);
nmax:=filesize (townsfile);
SetLength (townsmas, nmax);
SetLength (waysmas, nmax);
nmax:=nmax-1;
for i:=0 to nmax do
begin
readln (townsfile, str);
townsmas [i]:=str;
end;
sluzh.NalWay:=false;
sluzh.price:=0;
sluzh.time.dd:=0;
sluzh.time.hh:=0;
sluzh.time.mm:=0;
for num1:=0 to nmax do
for num2:=0 to nmax do
waysmas[num1,num2]:=sluzh;
while not eof (waysfile) do
begin
num1:=-1;
num2:=-1;
read (waysfile, way);
for i:=0 to nmax do
begin
if way.town1=townsmas[i] then
num1:=i;
if way.town2=townsmas[i] then
num2:=i;
end;
if num1>=0 then
begin
waysmas[num1,num2].NalWay:=true;
waysmas[num1,num2].price:=way.price;
waysmas[num1,num2].time:=way.time;
end;
end;
closefile (townsfile);
closefile (waysfile);
combobox1.Text:=townsmas[0];
combobox2.Text:=townsmas[0];