PDA

View Full Version : تابعی برای چک کردن تاریخ شمسی در edit



khaterer
دوشنبه 06 دی 1389, 14:13 عصر
سلام
می خواستم بدونم تابعی برای چک کردن تاریخ شمسی موجود در edit وجود دارد ؟

سعید صابری
دوشنبه 06 دی 1389, 21:32 عصر
خودت میتونی بنویسی.

mahdy.asia
جمعه 10 دی 1389, 07:55 صبح
procedure TMTBI_LabeledMaskDate.KeyPress(var Key: Char);
var
R:Smallint;
Y,M,D:Smallint;
Sy,Sm,Sd:string;
begin
R:=1;
Sy:=Trim(copy(Text,1,2));
Sm:=Trim(copy(Text,4,2));
Sd:=Trim(copy(Text,7,2));
IF Sy<>'' THEN
M:=StrToInt(Sy);
IF Sm<>'' THEN
M:=StrToInt(Sm);
IF Sd<>'' THEN
D:=StrToInt(Sd);
if (Sy='') or (Sy='__') then Y:=0;
if (Sm='') or (Sm='__') then M:=0;
if (Sd='') or (Sd='__') then D:=0;
if (M>12) then R:=-1;
if (D>31) then R:=-1;
if (M>6) and (D>30)then R:=-1;
if ((Y mod 4)<>3) and (M=12) and (D=30) then R:=-1;
IF Sy<>'' THEN
Y:=StrToInt(Sy);

if key=#13 then
begin
if R=-1 then
ShowMessage('ÊÇÑíÎ ÇÔÊÈÇå æÇÑÏ ÔÏå ÇÓÊ');
if R=1 then
if (FDT_Start > Text) or (FDT_End < Text) then
ShowMessage('ÊÇÑíÎ ÎÇÑÌ ÇÒ ãÍÏæÏå ãÚÑÝí ÔÏå ãí ÈÇÔÏ');
end;
inherited;
end;

khaterer
سه شنبه 28 دی 1389, 14:17 عصر
سلام
ممنون لطف کردید خودم تابعی رو نوشتم اما بازم ممنون