Autor Beitrag
Dhakiyah
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Mi 02.09.09 15:34 
Hallo!
Ich habe zwei DateTimePicker.
Der zweite steht auf now.
Der erste soll sich auf den 01. des aktuellen Monats stellen.

Beispiel:
DateTimePicker2 = 18.03.2009
DateTimePicker1 soll sich dann automatisch auf den 01.03.2009 stellen.

Wie mache ich das?
Mit encodedate?

LG
Jasmin

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Tfrm_mdi_protokoll.FormActivate(Sender: TObject);
var d_Tag : tdate;
    i_jahr, i_monat, i_tag: integer;
begin
  d_tag:= encodedate(i_jahr, i_monat, i_tag);
  dtp_von.DateTime:= ???;
  dtp_bis.DateTime:= now;
  opt_einzel.Checked := true;
end;

_________________
Es ist soooo flauschig !!!
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 02.09.09 15:41 
ausblenden Delphi-Quelltext
1:
2:
3:
decodedate(now, i_jahr, i_monat, i_tag);
d_tag := endcodedate(i_jahr, i_monat, 1);
dtp_von.DateTime:= d_Tag;


könnte es das sein?

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Dhakiyah Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Do 03.09.09 07:09 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure Tfrm_mdi_protokoll.FormActivate(Sender: TObject);
var d_Tag : tdate;
    i_jahr, i_monat, i_tag: integer;
begin
  decodedate(now, i_jahr, i_monat, i_tag);
  d_tag := encodedate(i_jahr, i_monat, 1);
  dtp_von.DateTime:= d_Tag;
  dtp_bis.DateTime:= now;
  opt_einzel.Checked := true;
end;


Kommt folgender Fehler:
E2033 Die Typen der tatsächlichen und formalen Var-Parameter müssen übereinstimmen

ausblenden Delphi-Quelltext
1:
  decodedate(now, i_jahr, i_monat, i_tag);					


Ist das nicht überflüssig?

LG

_________________
Es ist soooo flauschig !!!
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Do 03.09.09 07:14 
i_Jahr usw. musst Du als Word deklarieren, statt Integer.

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)
Dhakiyah Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Do 03.09.09 07:26 
Und wieso?

_________________
Es ist soooo flauschig !!!
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Do 03.09.09 07:34 
Schau mal in die Hilfe von DecodeDate. Das Ding erwartet nunmal Word und nicht Integer. Wenn Du in Dein Benzinauto Diesel kippst wird es auch nicht funktionieren.

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)
Dhakiyah Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Do 03.09.09 07:36 
Das versuche ich heute mal :autsch:

_________________
Es ist soooo flauschig !!!