Eric,
I may be misunderstanding what you want to do, but it sounds like you just want to cast the object to the correct type (I'm assuming, maybe incorrectly, that you know what that type should be?)
Type t = Type.GetTypeFromProgID(cProdID)
MyBaseObject MyClass = (MyBaseObject)Activator.CreateInstance(t)
~~Bonnie
>In this case I want to create an object from a registered VFP DLL. But not referenced as an Interop Assembly. I need VFP objects available in a windows service app. I want to pause the service, rebuild my DLLs then continue the service. This works fine if I re-add the reference in the service project and rebuild the service but it's not practical to do that. I tried this:
>
>Type t = Type.GetTypeFromProgID(cProdID)
>object MyClass = Activator.CreateInstance(t)
>
>The trouble is the IDE doesn't recognize the typeof Myclass until runtime. It only sees typeof object not the type represented in cProgID.
>
>I think I need to declare MyClass as the typeof(cProgID) but i'm having trouble with the syntax.
>
>Thanks,
>
>-E
>
>
>
>
>>>Does anyone have a preferred way to create an object from a registered server?
>>>
>>>What is the equivalent of CreateObject in C#?
>>
>>new
>>
>>Cetin