var
S: TStringList;
M: TStream;
pega : string;
begin
S := TStringList.Create;
M := TMemoryStream.Create;
pega := Listaimportados.Items[i];
Inc(i);
nome.text := Copy(pega, 0, 16);
sobrenome.text := Copy(pega, 18, 2);
valor.text := Copy(pega, 23, 2);
try
S.Values['processamento'] := 'normal';
S.Values['nome'] := nome.text;
S.Values['sobrenome'] := sobrenome.text;
S.Values['valor'] := valor.text;
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post('http://localhost/envia.php', S, M);
Memo1.Lines.Add(Format('Resposta: %s', [IdHTTP1.ResponseText]));
M.Position := 0;
S.LoadFromStream(M);
Memo1.Lines.AddStrings(S);
finally
S.Free;
M.Free;
end;
end;
I really need the program not to crash and that whenever the response arrives it should jump to the next line (maybe Inc (i);), I'll do this check like? in another timer?.