>Hi,
>
>I am adding a property FIELD_CONTAINER to a form, which works initially. But when I want to set a different class to the same property, I get error.
>
>Here is the snipet of the code:
>
>
>IF !TYPE( "thisform.field_container") = "O"
> *-- Add this container to the form
> thisform.newobject( "field_container", "myclass1", "myclasslib.vcx" )
> *-- Works!
>ELSE
> *-- I want to use the same property (FIELD_CONTAINER but use a different class
> thisform.field_container = NEWOBJECT("myclass2", "myclasslib.vcx" )
> *-- Error message:
> *-- FIELD_CONTAINER is a method, event, or object
>ENDIF
>
>
>What am I am missing? TIA
You either should use this.Property = newobject(...) -- but you can only do this for custom classes and they will not be "added to the form"
or
Remove the original container first and create a new container.
Use RemoveObject method first and then re-add the new container using the same name.
In other words, you will be re-using the same name for the new object (and not an object property).
If it's not broken, fix it until it is.
My Blog