Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return value of NewObject()
Message
From
24/04/2002 15:16:09
Beth Wetherbee
Virginia Beach Public Schools
Virginia Beach, Virginia, United States
 
 
To
24/04/2002 11:02:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00648685
Message ID:
00648831
Views:
27
>Hi Beth.
>
>>Can someone tell me why This.NewObject() would return a .T. even if the object being created by NewObject did not instatiate?
>
>The VFP Help file doesn't indicate any return value for the NewObject method, so I'm guessing that it always returns .T. I agree that it would be nice if it returned .F. if the instantiation didn't work, but in the meantime, you can use code like the following instead:
This.NewObject('NewMember', ...)
>if type('This.NewMember.Name') = 'C'
>* object was created
>endif
Doug

Thanks Doug.

It is curious to me that the function NEWOBJECT() does seem to return .F. if instatiation doesn't work but that the method This.NewObject() always seems to return .T.

Anyway, thanks for reassuring me that I'm not going crazy (at least in this particular case <g>).
Beth Wetherbee, MCSD
VBCPS
Previous
Reply
Map
View

Click here to load this message in the networking platform