Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Addproperty causing an error
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00854147
Message ID:
00854662
Views:
15
Gerard,
In what methods do you have your code? Form Init or Load? Control Init?

The sequence may be important. ControlSources should be set up in the Form's Load because this fires prior to instantiation of any control. However, during the Load, no controls are available because they haven't been instantiated yet. If you try and access them, they will fail.

On the other hand, in the Form's Init, all controls have been instantiated but if the ControlSource isn't valid (e.g. if you are setting the ControlSource up in the Form's Init), the instantiation will fail.

Regards.

>Hi.
>I have a comand as follows :
>oObject.Addproperty('MyNewProperty')
>
>The control Source of OObject happens to be :
> Thisform.objMemVar.Myfield
> (From a Scatter Name command)
>
>When the Addproperty is being run, the ObjMemVar.Myfield does not exist and the Addproperty comes up with an error message. If I remove thew control Source, or change it to a property of the form that does exist when the Addproperty is being run, its ok.
>
>
>It looks like the AddProperty does some sort of validation on the object and looks for a valid ControlSource property.
>Unfortunately, this is not created until later on.
>
>Has anybody come across this and know a way around it ?
>
>Regards,
>
>Gerard
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform