Autor Beitrag
dinu_ch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: So 09.11.03 18:21 
Ich habe da ein kleines Programm geschrieben welches auf Mausklick Labels weiterleitet - 1 zu 2 usw. Die Eingabe des 1.Labels erfolgt über ein edit-Feld. wie kann ich die Eingabe prüfen ? Ich hab da mal sowas gemacht, aber das funzt nicht :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure CheckEdit;

var
x,code : integer;

begin
val(frm1.edit.text,x,code);
if (code<>0) then begin
showMessage(' Zahl eingeben');
frm1.edit.setfocus
end;
end;

Das heisst, die Meldung kommt schon ob Zahl oder nicht, aber der Rest läuft weiter. Ich möchte das zwingend eine Zahl eingegeben werden muss, sonst werden keine Labels weitergeschoben.

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 09.11.03 19:05 
wo rufst du denn diese Procedure auf?

Es gibt im Forum einige Threads dazu, wie man in editfeldern nur Zahlen zuläßt. Such mal danach.

mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Mo 10.11.03 08:35 
Du kannst das auch mit dem OnKeyDown Ereignis machen und wenn der Key irgenwas anderes als eine Zahl ist dann machst du ihn einfach zu einer.

_________________
...To err is human, but to really foul things up requires a computer.