Results 1 to 4 of 4

Thread: As New & MTS

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Location
    y
    Posts
    141
    Hi All
    I need to write a component that be in MTS
    But my Boss say that As New is not Good
    And i need to use create Object

    Why ??????

    Thanks
    Efrat

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Wink

    I told you why!

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    In case anyone else cares:

    (If I remember correctly)
    Use CreateObject (Actually, late binding) to instantiate objects that reside within the control of MTS. This allows the object contexts of both components to communicate, i.e. allow the calling component to determine whether the component being called completed successfully (via setcomplete or setabort)


    Use AS NEW (early binding, but you can use CreateObject to achieve early binding, but I won't get into that) to instantiate objects that do not reside within MTS. You'll commonly use this for your ADO objects and the objectcontext objects, among others


    Tom

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Actually, a correction

    Use early binding with createobject

    example:
    Code:
    dim objMyObject as MyMtsObject.ClassName
    dim objContext as mtxas.objectcontext
    
    set objcontext = mtxas.getobjectcontext
    
    set objMyObject = objContext.CreateInstance("MyMTsObject.ClassName")
    
    objMyObject.Foo()
    
    'etc....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width