17-06-2017, Saat: 22:35
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in [#8, '0'..'9', '-', DecimalSeparator]) then
ShowMessage('Invalid key: ' + Key);
Key := #0;
end
else if ((Key = DecimalSeparator) or (Key = '-')) and
(Pos(Key, Edit1.Text) > 0) then begin
ShowMessage('Invalid Key: twice ' + Key);
Key := #0;
end
else if (Key = '-') and
(Edit1.SelStart <> 0) then begin
ShowMessage('Only allowed at beginning of number: ' + Key);
Key := #0;
end;
end;
internetten bulduğum kod parçası kendine göre uyarlayabilirsin

