this segment in my program first ads a customer to a textfile (declared in public variables) and saves it to a texfile. onbutton1click is the procudere to search the string thats in the editbox and return the relevant customer details to memo. the add customer works fine and adds to textfile, however when i search it returns nothing onto the memo, just the memo caption, memo1. any way i can resolve this? sorry im a newb to this.
procedure TForm2.btnsaveClick(Sender: TObject);
begin
cusfname:= edit1.text ;
cuslname:= edit2.text;
adress:= edit3.text;
phone:= edit4.text;
password:= edit5.Text;
AssignFile(F, 'Data.txt');
append(F);
WriteLn(F, cusfname);
WriteLn(F, cuslname);
WriteLn(F, adress);
WriteLn(F, phone);
WriteLn(F, password);
CloseFile(F);
end;
procedure TForm2.Button1Click(Sender: TObject);
var
SearchFile : Textfile;
found: boolean;
search: string;
begin
search := edit1.text;
Assignfile(SearchFile, 'data.txt');
Reset(SearchFile);
found:= false;
repeat
found:= search = phone
until eof(searchfile) or found;
if found then
memo1.append(phone);
memo1.append(cusfname);
memo1.append(adress);
if not found then
showmessage('member not found');
end;