1
I need to trigger an error message if the user tries to enter invalid codes in a temporary table on grid. The codes come from a .txt
. The codes fired on the monitor are ok but the message is repeated n times as there are n incorrect codes. I would like a single message to be fired with the incorrect code list. How to do this? Thank you.
// procedure para leitura do texto
var
myFile : TextFile;
begin
AssignFile(myFile, arquivoTxt);
Reset(myFile);
while not Eof(myFile) do
begin
ReadLn(myFile, text);
InsereTexto;
end;
CloseFile(myFile);
end;
// procedure para inserir dados do txt no banco
begin
if not qrSELCSPCliente.Locate('CSC_CAP_NroCartao', StrToInt(text), []) then
begin
{INSERE DADOS NO BANCO do txt}
else
begin
MsgAviso('Número já cadastrado!' + text);
end;
end;
Ricardo, thank you so much! Elegant and functional solution. I declared "messages" as a global variable and after
CloseFile(myFile);
of the text reading process I reset the variable "messages".– Mariana de Amorim Delfino