Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object is not contained in a form
Message
 
 
To
01/09/2017 11:58:15
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01653920
Message ID:
01653928
Views:
44
>>Hi,
>>
>>The title of this thread is the error message I get in this situation.
>>
>>I have a form and a class is dropped on this form. E.g. class MyClass1. It is instantiated with any problem.
>>
>>In the INIT of this form another class is instantiated as follows
>>
>>
>>thisform.oMyClass2 = NEWOBJECT( "MyClass2", "MyClass2Lib.VCX")
>>
>>
>>When when I want to get/reference a property of the MyClass1 in a method of MyClass2, I get error "Object is not contained in a form." The way I reference class MyClass1 in a method of MyClass2 is as follows:
>>
>>
>>thisform.MyClass1.aProperty
>>
>>
>>I thought that since MyClass2 is in the same form that instantiated the MyClass1 I would be able to reference it, but apparently I am wrong. What am I missing?
>
>May be completely wrong again but ..........
>
>you create oMyClass2
>and are referencing MyClass1
>
>which seems inconsistent. Is there a typo for the "o" in one of the class names or code reference?

I don't think there is a typo. It is just that my example was kludgy.
The explanation and the solution that Thierry outlined should work. I have not tested it but I have full trust that he knows what he is talking about.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform