SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ Use Edit component for password

First of all, change PasswordChar property of Edit component that nobody saw your password, when you type it.
In this example, length of password must be only 4 symbols.

procedure TForm1.Edit1Change(Sender: TObject);
begin
  with Sender as TEdit do
    if Length(Text)>4 then
    begin
      Edit1.Text:='';
      MessageBeep(0);
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  MessageBox(
    Form1.Handle, 
    PChar('You have just written - '+Edit1.Text),
    'Password checking',
    1);
end;
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes