Einzelnen Beitrag anzeigen

Benutzerbild von Lantis
Lantis

Registriert seit: 13. Mär 2003
16 Beiträge
 
Delphi 6 Personal
 
#6

Re: Minus im edit nur als erstes Zeichen erlauben

  Alt 22. Dez 2003, 12:56
Könnte ungefähr so aussehen:
Delphi-Quellcode:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9',#8,#44,#45]) then Key := #0;
  if (length(edit1.Text)>0) and (Key in [#45]) then Key := #0;
  if (pos(#44,edit1.Text)>0) and (Key in [#44])then Key := #0;
end;
Gruß Lantis
  Mit Zitat antworten Zitat