Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date becomes datetime in item-Class
Message
De
04/03/2007 19:14:16
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01200600
Message ID:
01200617
Vues:
18
Sergey,

>It's not a bug. See my reply to Frank.

You were too fast for me. I was just modifying my reply to be this (but you replied before I could save it).

STOP THE PRESSES! (update) OK, I figured out what is happening. It's because FOR EACH with Collection has problems in certain circumstances, due to the fact that Collection actually uses a COM interface internally.

You have two solutions:
1) Pre-VFP9 use FOR lnLoop = 1 TO THIS.Count:
for lnloop = 1 TO this.count
   ? this.item(lnLoop).ddate
endfor
2) In VFP9 add the FOXOBJECT keyword onto the FOR EACH line:
for each loItem in this FOXOBJECT
   ? loItem.dDate
endfor &&* each loItem in this.Items
From VFP9 help:
FOR EACH ... ENDFOR Command Preserves Object Types
Visual FoxPro now includes the FOXOBJECT keyword for the FOR EACH ... ENDFOR command to support preservation of native Visual FoxPro object types.

FOR EACH objectVar [AS Type [OF ClassLibrary ]] IN Group FOXOBJECT

Commands

[EXIT]

[LOOP]

ENDFOR | NEXT [Var]

The FOXOBJECT keyword specifies that the objectVar parameter created will be a Visual FoxPro object. The FOXOBJECT keyword only applies to collections where the collection is based on a native Visual FoxPro Collection class. Collections that are COM-based will not support the FOXOBJECT keyword.

For more information, see FOR EACH ... ENDFOR Command.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform