Autor Beitrag
elimhren
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21


D6 Prof
BeitragVerfasst: Mo 14.07.03 20:07 
ihr seid meine letzte hoffnung...
um mein problem zu verstehen, bitte kurzes programm nachstellen - formular mit einem monthcalender (registerkarte win32) & einem button, dort im onclick

ausblenden Delphi-Quelltext
1:
2:
 monthcalendar1.date := strtodate('15.07.03');
if monthcalendar1.Date = strtodate('15.07.03') then showmessage('hi');


warum funktioniert das nicht & viel wichtiger warum funktionierst wenn ich im kalender den 15.07.03 manuell anklicke?

vielen dank !!!
johannes

Moderiert von user profile iconTino: Titel geändert.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 14.07.03 21:39 
Das Problem ist, dass die Eigenschaft Date im Kalender auch die Uhrzeit gespeichert hat. Du musst also einen Vergleich ohne die Uhrzeit machen.
Hier ein Beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  Datum: TDate;
begin
  Datum := StrToDate('15.07.2003');
  MonthCalendar1.Date := Datum;
  if DateToStr(MonthCalendar1.Date) = DateToStr(Datum) then
    begin
      ShowMessage('Hi');
    end;
end;


Durch DateToStr wird nur das Datum in einen String verwandelt. Die Zeit wird ignoriert.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
elimhren Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21


D6 Prof
BeitragVerfasst: Di 15.07.03 09:52 
Titel: vielen dank!
danke dir!! :D