>Hi,
>
>I have the following code that adds some containers "on the fly". This works in dev mode and the class library containing the classes is in the ClassLib stack :-
>
>
>m.cPageExpr = 'THIS.Page' + TRANSFORM(THIS.ACTIVEPAGE)
This can be simplified into
oPage=this.pages[this.activepage]
>IF NOT PEMSTATUS(EVALUATE(m.cPageExpr), 'oCntethniccountsview04', 5)
> EVALUATE(m.cPageExpr + [.ADDOBJECT('oCntethniccountsview04', 'cntethniccountsview04')])
> m.oContainer = EVALUATE(m.cPageExpr + '.oCntethniccountsview04')
> m.oContainer.TOP = 263
> m.oContainer.LEFT = 250
>ENDIF
>IF NOT PEMSTATUS(EVALUATE(m.cPageExpr), 'oCntethniccountsview05', 5)
> EVALUATE(m.cPageExpr + [.ADDOBJECT('oCntethniccountsview05', 'cntethniccountsview05')])
> m.oContainer = EVALUATE(m.cPageExpr + '.oCntethniccountsview05')
> m.oContainer.TOP = 263
> m.oContainer.LEFT = 234
>ENDIF
>THISFORM.oStateManager.BroadCast('REG YEAR')
>
>
>However, on site, we are getting a somewhat annoying "Locate Class" dialog that says ... "Error instantiating class. Cannot find "c:\vgs\source\hecontainers.vcx".
>FYI, hecontainers.vcx is built in to the .EXE file.
>VFP must have found the hecontainers.vcx library in the classlib stack because it has at the very least identified which VCX the container classes belong to or can be found in with no clue from the developer code ie., ADDOBJECT() does not have a "cModule" type property in which to specify the containing library file. The VCX (and many others in question) are built in to the distributed EXE and are in the SET CLASSLIB TO stack.
Can you just add a set("classlib") to your error log? Just to make sure the classlib is really included there.
Also, you may try with .NewObject() instead of .AddObject(), since the former is independent from set("classlib").