Delphi 2010: Run time error 217 at 00406786.
I don’t know what the error is, here’s the code:
procedure TForm1.FormCreate(Sender: TObject); var Params:TStringList; InetParams:TStringList; i,k:Integer; inipath:string; begin {Settings section start} inipath:=GetCurrentDir+'\services.ini'; Settings:=TIniFile.Create(inipath); Params:= TStringList.Create; InetParams:=TStringList.Create; try Params.StrictDelimiter:= True; Params.CommaText:= Settings.ReadString('Telephone', 'catidx_values', '-1'); TEL_SERV_COUNT:=Params.Count; SetLength(tel_serv, TEL_SERV_COUNT); i:=1;k:=1; while i<=TEL_SERV_COUNT do begin tel_serv[I] := Trim(Params[I-1]); inc(i); end; InetParams.CommaText:= Settings.ReadString('Internet', 'catidx_values', '-1'); INET_SERV_COUNT:=InetParams.Count; SetLength(inet_serv, INET_SERV_COUNT); while k<=INET_SERV_COUNT do begin inet_serv[k]:= Trim(InetParams[k-1]); //ShowMessage(Inet_serv[i]); // ShowMessage(InetParams[k-1]); Inc(k); end; finally Params.Free; InetParams.Free; Settings.Free; end; {Settings section end} end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin //Application.Terminate; end; I have already tried all the options for closing the program, but all the time it shows an early-time error. Why? PS: It is interesting that if you comment the line in the second cycle
inet_serv[k]:= Trim(InetParams[k-1]); then there will be no mistake at all ... What could be, pliz ... Waiting for help and advice.