Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding Controls to ADO Recordset
Message
From
23/05/2001 05:51:44
 
 
To
22/05/2001 22:53:10
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00510179
Message ID:
00510233
Views:
34
This message has been marked as the solution to the initial question of the thread.
Hi!

InputMask for datetime field have no effect. Try following: put a textbox on a form, specify {} in its value. Than try to set ImputMask. Everything you enter there ignored and InputMask property remains empty.

The solution is only to make a custom text box class that will work correct way. When such text box initialized, clear the control source and remember it in another property of the text box. In the Refresh event assign the date portion of the control source value to the Value property of TextBox. In the Valid event store the Value property back into the control source after converting it to the datetime. There are DTOT and TTOD functions in VFP.

If you want a custom input mask, however, in addition to above, you require to use a character type for the value property of TextBox (convert datetime to character and back).

HTH.


>Hang on...
>
>It works fine for numbers but not dates!
>
>Since SQL Server does not have a date field type (only a datetime), the ADO field is a datetime and does not honor the '99/99/9999' Input Mask setting. It is showing the time portion as well.
>
>>Never mind!
>>
>>I was using the Format property to do what the Input Mask property is supposed to do! I need a rest.....
>>
>>
>>>I have taken over a project that was partially completed. It is using SQL Server backend and ADO to communicate to the front end.
>>>
>>>The people on the project prior to my taking over, subclassed some controls (textbox, editbox, etc) and made them so that they can be bound to fields in an ADO Recordset.
>>>
>>>This all works fine except I cannot get these controls to honor the Format property. I want a numeric field to be formatted '9,999.99'. It always displays with several zeros after the decimal and no comma.
>>>
>>>Does anybody know how to make the controls honor the formats?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform