Instantiate COM+ using New keyword
Posted on 2003-03-25
I've already learned that when doing programming for a COM+ class we must get rid of New keyword if we need to instantiate another object hosted in COM+. However, is it allowed to instantiate a class hosted in COM+ using New keyword from VB client? Let's say I've got a Foo class hosted in COM+ then is it ok to instantiate it in my VB Form like this:
Dim objFoo as MyComponent.cFoo '// cFoo is a COM+ hosted class
set objFoo = new cFoo
or should I instantiate it using CreateObject?
Dim objFoo as MyComponent.cFoo
set objFoo = CreateObject("MyComponent.cFoo")
Which one is better and safest?
Thanks for any help