Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi try-except (strtoint) geht nicht (https://www.delphipraxis.net/83178-try-except-strtoint-geht-nicht.html)

turboPASCAL 29. Dez 2006 07:49

Re: try-except (strtoint) geht nicht
 
Also ich würde ja gar nicht erst nix anderes als Zahlen im Editfeld zulassen ala:

Delphi-Quellcode:
procedure TMyFormX.EditXKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', Chr(VK_TAB), Chr(VK_BACK), Chr(VK_RETURN), Chr(VK_DELETE)]) then
  begin
    Key := #0;
    MessageBeep(0);
  end;
end;

Muetze1 29. Dez 2006 11:37

Re: try-except (strtoint) geht nicht
 
Zitat:

Zitat von turboPASCAL
Also ich würde ja gar nicht erst nix anderes als Zahlen im Editfeld zulassen ala:...

Wobei wir bei einer solchen Lösung schon mehrfach darauf hingewiesen haben, dass diese nicht sicher ist. Man kann mit den normalen ClipBoard Funktionen frei Text einfügen. Dann sind auch nicht-Zahlen in dem Editfeld und es kommt zum Fehler...


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:18 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz