CreateObject vs New

Discussion in 'ASP .Net' started by Eric Brooksby, Oct 29, 2004.

  1. Ok, so I am a bit new with asp.net. I have done everything to import
    the com object correctly in ASP.NET and the following line works like
    a charm.

    Dim MeSrvCtrl As New MeSrvCtrlClass


    Why does the following line not work?


    MeSrvCtrl = CreateObject("MeSrvCtrlClass", Myserver_name)


    As far as I can read these two are supposed to be basicaly the same.
    Any help would be appriciated.

    Eric
     
    Eric Brooksby, Oct 29, 2004
    #1
    1. Advertising

  2. well there is difference between create object and new method for creating
    objects
    create object cannot be used if instancing property of class is set private
    or public not creatable.
    Check that
    "Eric Brooksby" wrote:

    > Ok, so I am a bit new with asp.net. I have done everything to import
    > the com object correctly in ASP.NET and the following line works like
    > a charm.
    >
    > Dim MeSrvCtrl As New MeSrvCtrlClass
    >
    >
    > Why does the following line not work?
    >
    >
    > MeSrvCtrl = CreateObject("MeSrvCtrlClass", Myserver_name)
    >
    >
    > As far as I can read these two are supposed to be basicaly the same.
    > Any help would be appriciated.
    >
    > Eric
    >
     
    =?Utf-8?B?Tml0aW4=?=, Oct 29, 2004
    #2
    1. Advertising

  3. Hi Eric,

    Those two are far from the same. The Visual Basic CreateObject function is
    for the purpose of instantiating COM objects, not .Net classes.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "Eric Brooksby" <> wrote in message
    news:...
    > Ok, so I am a bit new with asp.net. I have done everything to import
    > the com object correctly in ASP.NET and the following line works like
    > a charm.
    >
    > Dim MeSrvCtrl As New MeSrvCtrlClass
    >
    >
    > Why does the following line not work?
    >
    >
    > MeSrvCtrl = CreateObject("MeSrvCtrlClass", Myserver_name)
    >
    >
    > As far as I can read these two are supposed to be basicaly the same.
    > Any help would be appriciated.
    >
    > Eric
     
    Kevin Spencer, Oct 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Casey Brown

    CreateObject question

    Casey Brown, Dec 15, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    Casey Brown
    Dec 15, 2003
  2. Raúl Martín
    Replies:
    1
    Views:
    10,950
    Natty Gur
    May 13, 2004
  3. Andrew Hilton

    Server.CreateObject() vs new ActiveXObject()

    Andrew Hilton, Feb 23, 2006, in forum: ASP General
    Replies:
    4
    Views:
    1,031
    Egbert Nierop \(MVP for IIS\)
    Mar 3, 2006
  4. ashish
    Replies:
    1
    Views:
    469
    ashish
    Aug 14, 2007
  5. Sagar

    Server.CreateObject Vs CreateObject

    Sagar, Jan 15, 2008, in forum: ASP General
    Replies:
    2
    Views:
    344
    Sagar
    Jan 15, 2008
Loading...

Share This Page