Autor Beitrag
tc4xe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Di 10.04.07 08:39 
Hallo, habe hier ein Problem..

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
if (Length(tag.Text)<=31) and (Length(tag.Text)>0) and
   (Length(monat.Text)<=12) and (Length(monat.Text)>0) and
   (Length(jahr.Text)<=2099) and (Length(jahr.Text)>1980)
   then
    showmessage('Eingabe OK!')
     else MessageDlg('Datum korrigieren',mterror,[mbok],0);


Auch wenn die Eingabe ok ist bekomme ich "Datum korrigieren" angezeigt.

Woran kann das liegen?

MfG
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 10.04.07 08:43 
Titel: Re: Datumeingabe prüfen (if,and,if,and... etwas stimmt nicht
user profile icontc4xe hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
if (StrToInt(tag.Text)<=31) and (StrToInt(tag.Text)>0) and
   (StrToInt(monat.Text)<=12) and (StrToInt(monat.Text)>0) and
   (StrToInt(jahr.Text)<=2099) and (StrToInt(jahr.Text)>1980)
   then
    showmessage('Eingabe OK!')
     else MessageDlg('Datum korrigieren',mterror,[mbok],0);



Verwende einfach statt der Längenprüfung length() die Funktion StrtoInt()

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
tc4xe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Di 10.04.07 08:44 
Oh man :D

Ist schon peinlich ^^

Edit: Jetzt klappt es natürlich ...
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 10.04.07 09:40 
ausblenden Delphi-Quelltext
1:
2:
if IsValidDate(StrToInt(Year.Text), StrToInt(Month.Text), StrToInt(Day.Text)) then
  ShowMessage('Korrekt');

(Unit DateUtils)

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)