>Hi Fred,
>
>Yes, many examples. All to do with the fact that we write class definitions in code on the fly during run time to a temporary procedure file, then execute the procedure file to define the class, then add the class to the parent object.
>
>In most cases, if there is anything wrong with the code that defines the class, an error results. But in some cases an error does not result even though a problem with the define code has prevented the class from being defined, and the AddObject() code errors out when it attempts to create an object from a class that has not been defined.
>
>It is for this reason that I need to know if the class was actually defined and exists in memory BEFORE I attempt to AddObject() from the class. I have not found a native VFP process that will tell me whether or not the class has been defined and exists in memory.
>
>At the moment I am merely trapping the error that results from attempting to AddObject() from a class that has not been defined. This is not a happy solution.
>
>Regards,
Since you're compiling these on the fly, could you check if there is a .ERR file of your generated .PRG that contains the class after you do the COMPILE command? That may provide some relief from trying to trap a AddObject error.