Autor Beitrag
dm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: Di 06.07.04 13:14 
Hallo,

ich weiss zwar dass das irgendwie mit nem Array funktioniert, aber wie muss der korrekte code lauten ?


Danke + Gruß

DM
SvenAbeln
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 334
Erhaltene Danke: 3



BeitragVerfasst: Di 06.07.04 13:34 
Hallo,

benutze einfach OnKeyPress des Editfelds um die eingegebenen Zeichen zu filtern.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9']) then Key:=#0;
end;


Falls Key nicht zwischen 0 und 9 ist wird das Zeichen einfach wieder gelöscht.


Gruß,
dm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: Di 06.07.04 13:38 
Titel: Danke
Danke SvenAbeln.

ich hab die hochkommata bei 0 und 9 vergessen, somit klappte es bei mir nicht.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);   
begin   
  if not (key in ['0'..'9']) then Key:=#0;   
end;


Danke für den Code.


Grüße Dennis

Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt.