1. set the edit field MaxLength to 6
2. a bit Code as follows:
procedure TForm3.btnSaveClick(Sender: TObject);
var
s:string;
len:integer;
begin
s:=trim(edtInput.Text);
len:=length(s);
if (len=0) then
begin
beep;
showMessage('Not input value');
end;
if (len>6) then
begin
beep;
showMessage('Input length over 6');
end;
edtInput.SetFocus;
end;