Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM+, New, CreateObject - need help

Status
Not open for further replies.

kensheehimura1

Programmer
Jun 2, 2003
19
PH
good day,

im creating a com+ application, a client/server application,using visual basic 6, with 2 library or project , named BOShoeLib, And DOShoeLib which consist of several components on it, when coding on class on BOShoeLib and creating instance of the components in DOShoeLib i use the CreateObject Keyword, but when im going to access components in the same library, BOShoelib, for Example when im coding in the BOShoelib Project, and create an instance of an object withing thesame project i use new

Example:

1. BOShoelib to DOShoelib
dim doCustomer as DOShoelib.Customer
set doCustomer = createobject("DOShoelib.Customer")

2. BOShoeLib to BOShoelib
dim boCustomerReg as BOShoelib.CustomerReg
set boCustomerReg = new BOShoelib.CustomerReg

is the second item correct? or do i have to use Createobject instead of new? which is better? thanks,

GOD BLESS....
 
I believe your second option is the better method, I always use it. Ill qualify always - except in cases where you must use CreateObject. Such as referancing external processes like Excel.application

There are two documents in MSDN worth reading. "How Object Creation Works in Visual Basic Components" and "Speeding Object References"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top