ผู้เขียน หัวข้อ: ตัวอย่างการใช้ if ใน delphi  (อ่าน 6129 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

doramon

  • บุคคลทั่วไป
ตัวอย่างการใช้ if ใน delphi
« เมื่อ: เมษายน 02, 2011, 14:43:17 PM »
0
 if Condition then Statement else Statement;



var mda:string;
monthh: integer;
begin
    monthh:=strtoint(formatdatetime('mm',datetimepicker1.Date));

       if monthh=1 then
           mda:='jan'
       else if monthh=2 then
           mda:='feb'
       else if monthh=3 then
           mda:='3'
       else if monthh=4 then
           mda:='4'
       else if monthh=5 then
           mda:='5'
       else if monthh=6 then
           mda:='6'
       else if monthh=7 then
           mda:='7'
       else if monthh=8 then
           mda:='8'
       else if monthh=9 then
           mda:='9'
       else if monthh=10 then
           mda:='10'
       else if monthh=11 then
           mda:='11'
       else if monthh=12 then
           mda:='12';

    edit2.Clear;
    edit2.Text:=mda;

end;

ตัวอย่างแก้อันนี้

http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=20450.msg173998#new