W
wuyixy1
Unregistered / Unconfirmed
GUEST, unregistred user!
我想实现这样,就是输入班级edit1 和 姓名edit2后,先检查有没有该班级,有的话,进入该班级的目录,否则提示出错,然后检查是否有该学生名,有再进入该目录下,否则新建一个目录
procedure TForm1.Button2Click(Sender: TObject);
var
i,j,flag1,flag2:integer;
begin
flag1:=0;
flag2:=0;
for i:=0 to nmftp1.FTPDirectoryList.name.Count-1 do
begin
if(nmftp1.FTPDirectoryList.name.Strings=edit1.Text)
then begin
flag1:=1;
NMFTP1.ChangeDir(edit1.Text);
for j:=0 to nmftp1.FTPDirectoryList.name.Count-1 do
if(nmftp1.FTPDirectoryList.name.Strings[j]=edit2.Text)
then begin
flag2:=1;
NMFTP1.ChangeDir(edit2.Text);
break;
end ;
if(flag2=0)
then begin
NMFTP1.MakeDirectory(edit2.Text) ;
NMFTP1.ChangeDir(edit2.Text);
break;
end;
end;
end;
if(flag1=0)
then statusbar1.panels[0].text:='你输入的班级不对,请重新输入';
end;
提示这样的错误
project project1.exe raised exception class EacceseeViolation with message'Access violation at address 004786DB in module'project1.exe'. Read of address 00000008'. Process stopped;
procedure TForm1.Button2Click(Sender: TObject);
var
i,j,flag1,flag2:integer;
begin
flag1:=0;
flag2:=0;
for i:=0 to nmftp1.FTPDirectoryList.name.Count-1 do
begin
if(nmftp1.FTPDirectoryList.name.Strings=edit1.Text)
then begin
flag1:=1;
NMFTP1.ChangeDir(edit1.Text);
for j:=0 to nmftp1.FTPDirectoryList.name.Count-1 do
if(nmftp1.FTPDirectoryList.name.Strings[j]=edit2.Text)
then begin
flag2:=1;
NMFTP1.ChangeDir(edit2.Text);
break;
end ;
if(flag2=0)
then begin
NMFTP1.MakeDirectory(edit2.Text) ;
NMFTP1.ChangeDir(edit2.Text);
break;
end;
end;
end;
if(flag1=0)
then statusbar1.panels[0].text:='你输入的班级不对,请重新输入';
end;
提示这样的错误
project project1.exe raised exception class EacceseeViolation with message'Access violation at address 004786DB in module'project1.exe'. Read of address 00000008'. Process stopped;