Im doing some code where I enter the name and no numbers are allowed. Im using records and the procedure is working perfectly. once i enter the name i cant enter any numbers but the problem i found is that the name entered isnt being stored in my record. heres the code:
procedure NO_NUMBERS ( x , y, leng : integer; var s : string);
var
x1, loop1 : byte;
begin
loop1 := 1;
x1 := x;
s := '';
repeat
pin := readkey;
if (loop1 <> leng + 1) or (ord(pin) = 8) then
begin
if (ord(pin) = 0) then
begin
pin := readkey;
pin := chr(48);
end;
if (ord(pin) in [65..90]) or (ord(pin) in [97..122]) then
begin
write(pin);
s := s + pin;
loop1 := loop1 + 1;
x1 := x1 + 1;
end;
if (ord(pin) = 8) and (loop1 <> 1) then
begin
Delete(s,length(s), length(s));
gotoxy(x,y);
clreol;
write(s);
x1 := x1 - 1;
gotoxy (x1,y);
loop1 := loop1 - 1;
end;
end;
until (pin = chr(13));
end;
and im declaring it in the program as follows:
write(' 2. Name.................');
NO_NUMBERS(30,6,str_len,nm); {str_len is declared as const 15}
nm := mr.name;
any ideas pls ?:confused: