soonhuat ong wrote:
> I have a field 'F_MONTH' with datatype string.

Why not use a numeric type?

> Now i want to get the value from F_MONTH, and display it on DateTimePicker1 
> component.

TDateTimePicker is for picking whole dates, not just months. To choose 
only a month, use a combo box.

> For example: 03 will display March, 02 will display February.
> I know 29th of Februrary isn't a valid date, and i don't even have this value 
> in my database, the value just come out by itself. Try to drop a 
> DateTimePicker1 component, and set its format property to 'MMM', then on 
> buttonA click event write the following code then you'll get what error i 
> mean:
>  
> ButtonAClick Event : 
> DateTimePicker1.Date := recodemonth(Now, StrToInt('02'));
> 
> See i don't have any value with '29', i only pass 02 and want it to return me 
> "February". 

But you do have "29": Today is July 29! Try this code on Monday, and 
I'll bet it works fine.

Just because you haven't asked the control to display the entire date as 
a string doesn't mean you no longer have to have a valid date. The error 
you're getting isn't coming from the date-time control, anyway. It's 
coming from RecodeMonth when you ask it to turn July 29 into February 29.

If the day and year aren't important to the date-time picker, then don't 
leave those values to chance. Pick values that you know will work. Every 
month this year (and for all years in the future, so far as we know) 
will have a first day, so use 1 instead of 29.

DateTimePicker1.Date := EncodeDate(2005, F_Month, 1);

-- 
Rob


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hlbo60o/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1122638817/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to