>Hi Bill,
>
>>
>>form.load()
>> if !dodefault()
>> return .f.
>> endif
>> this.NewObject('myName','myClass')
>> return this.myName.myMethod()
>>
>>Is there any reason I should not add an object to a form in the Load() method?
>
>Other than that the form object doesn't have a NewObject method and the code above won't run, I can't think of any *bg*
>If you have no need of the "myClass" object other than to determine whether the form should load or not you want
>
>
>LOCAL loX
>lox = NewObject("myName", "myClass")
>RETURN lox.myMethod()
>
>
>If you want to use methods of myClass at other times during the life of your form then you want to use AddObject.
>
>
>This.AddObject("myName", "myClass")
>
>
>pamela
Hi Pamela,
Forms do have a NewObject() method. As near as I can tell it's the same as the AddObject() method, except you can name the vcx file that the class is in, so it doesn't have to be in the Set Classlib.
I also assumed that NewObject method and NewObject function were the same thing, but someone here corrected me (Sergey I think). The method creates an object with a Parent (the form or other container), but the function creates an object with no Parent. The function needs a name to give to the new object, but the function doesn't.
Bill Morris