Results 1 to 2 of 2

Thread: instancing question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Location
    u.s.a
    Posts
    127
    I do not understand why some objects are referenced using the new operator and some objects aren't.
    For example:
    If one uses DAO for connecting to databases, in order to declare a database object, you just have to use the Dim statment:
    Dim db as database
    But if one uses ADO, one has to declare the connection object with the new statment:
    set db = NEW ADODB.connection

    how can the DAO object be refferenced with out creating it using the NEW statement?

    Thanks.
    Dan.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Using a New keyword is a term for early binding. means that Object created as soon as you declare it.

    Here's is what MSDN has to say about it:

    New -

    Keyword that enables implicit creation of an object. If you use New when declaring the object variable, a new instance of the object is created on first reference to it, so you don't have to use the Set statement to assign the object reference. The New keyword can't be used to declare variables of any intrinsic data type, can't be used to declare instances of dependent objects, and can’t be used with WithEvents.

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