Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Display a date from a datetime?
Message
De
01/12/2004 06:41:51
 
 
À
01/12/2004 05:07:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
00965996
Message ID:
00966011
Vues:
12
Hi Angie.

I have a datetime column coming in via a remote view. In the date text box on the form, I want the value to display and enter as a standard date only (ie., without the : : time delimeters showing)

What I did was to create a class that unbinds the DateTime field in its Init() and saves the actual ControlSource to a custom cControlSOurce property of the textbox like so:
DODEFAULT()
*** Unbind the control and save the controlsource to a special property
IF NOT EMPTY( This.ControlSource )
  This.cControlSource = This.ControlSource 
  This.ControlSource = ''
ENDIF
This.Format = 'D'
This.Value = {}
Then I added a method called UpdateControlSource that is called from the control's Valid and UpdateValue that is called from its Refresh. Code like this in RefreshValue():
LOCAL ltValue

IF NOT EMPTY( This.cControlSource ) 
  ltValue = EVALUATE( This.cControlSource )
   
  *** Update the control's value from its cControlSource
  IF EMPTY( NVL( ltValue, {/:} ) )
   This.Value = {}
  ELSE
    IF VARTYPE( ltValue ) = 'T'
     This.Value = TTOD( ltValue )
    ELSE
      This.Value = ltValue
    ENDIF
  ENDIF
ELSE
  This.Value = {}
ENDIF
HTH.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform