Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange behavior
Message
From
12/06/2003 16:13:09
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00799544
Message ID:
00799555
Views:
24
Not weird at all. When you define a property you can't run any code to set its value.


>Hi!
>
>Take a look at this:
>
>Define Class MyClass As Session
>    Emp = CreateObject("MyOtherClass")
>EndDefine
>Define Class MyOtherClass As Session
>    Name = "Test!"
>EndDefine
>
>
>So...:
>
>MyObj = CreateObject("MyClass")
>? MyObj.Emp.Name && I got an error here...
>
>
>Open the DEBUG WINDOW, and type:
>MyObj
>
>So, open the "Emp" node and you can see the Name property and its value.
>
>But, if you type (in DEBUG WINDOW):
>MyObj.Emp -> "Expression could not be evaluated"
>
>Why it?
>
>To correct this problem, I just change my code:
>
>Define Class MyClass As Session
>    Emp = Null
>    Function Init
>        This.Emp = CreateObject("MyOtherClass")
>    EndFunction
>EndDefine
>Define Class MyOtherClass As Session
>    Name = "Test!"
>EndDefine
>
>
>[]s!
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform