Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding objects to arrays with AddObject. Bug in VFP 9?
Message
From
20/06/2005 09:17:30
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Adding objects to arrays with AddObject. Bug in VFP 9?
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Novell 5.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01024820
Message ID:
01024820
Views:
69
We we have this base class that basically implements a collection. Part of the process is to add an object to an array. This code word flawlessly on VFP6 for years.
this.ItemCount = this.ItemCount + 1
Dimension this.Item[this.ItemCount]

Local cItemPlace
cItemPlace = "Item[" + LTrim(Str(this.ItemCount)) + "]"

this.AddObject(cItemPlace, this.ItemClassName, &tInitParameters)
We are now preparing to upgrade our systems to VFP 9 and during the testing we get an "Object name is invalid" error on the line that adds the object. This error occurs very rare (maybe once every 10000 times that line is executed). If you retry it runs! One of the times I've seen a very weird thing in the debuger. The debuger properly showed the array containing objects and what appeared to be an object named "Item[30]" residing on the same object the array is sitting on (the code errored when it tried to add the 30th element). You can drill through the object in the debugger, but when you try to reference it as this.item[30], the element of the array is returned.

Anyone ran into this?
Next
Reply
Map
View

Click here to load this message in the networking platform