Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Databinding, for..each, null value related issue
Message
 
 
To
10/07/2006 16:30:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01135139
Message ID:
01135146
Views:
10
This message has been marked as the solution to the initial question of the thread.
It's know issue with FOR EACH and objects in collections. It returns COM reference to an object instead of VFP one. There's new clause FOXOBJECT in VFP9 that fixes the problem.
FOR EACH loItem IN this.oItemCollection FOXOBJECT
I also strongly recomend that you install SP1 because it fixes a lot of bugs.

>I've recently come across some odd behavior when working with textboxes bound to objects. In brief, I am not able to edit the contents of a textbox when it is bound to an object property containing a null value, and the object was retrieved/set via a for..each loop accessing a collection of objects... To make this clear I have included code below, but I will explain why I am doing this.
>
>On a certain form I need to access a number of child business objects. Instead of displaying each item in a grid, I wanted to use a separate page on a pageframe for each object. So I created a page class that contains a property to hold the object, and when that page instantiates, I bind the page data controls to properties of the business object. When my form loads, I access a static instance of my child class to retrieve a collection of instances that are related to my current parent business object. Then I iterate through this collection, and create a new instance of my special page class for each business object.
>
>This seemed like a pretty good solution until I noticed that I couldn't edit some of my textboxes. I am using .null. to indicate that a particular field has not yet received a value... I don't know what caused me to try to use for i = 1 instead of for...each, but I was suprised to see that this apparently fixed the problem.
>
>Any ideas about what is going on here? While there are many ways to handle business objects & binding on forms, I don't think I am doing any thing incorrect or invalid. I'm running VFP9, NO service pack.
>
>
<snip>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform