Results 1 to 2 of 2

Thread: byref vs BylVal

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    SA
    Posts
    13

    Lightbulb

    Can this cause me a problem

    This class declares
    dim dbConnect as clsDatabaseAccess
    set dbConnect = new clsDatabaseAccess
    dbConnect.connect
    dbConnect.execSQL
    ProcessFile(dbConnect)
    dbConnect.execSQL
    dbConnect.disconnect
    set dbConnect= Nothing

    Public Function ProcessFile(ByRef objDB As clsDatabaseAccess)
    objDB.execSQL
    end sub

    I don't know if this will cause a memory leak or not. I don't know what happens to the object passes as reference(objDB)

  2. #2
    Guest
    The only problem I see is that you are executing 3 times.

    But, passing the object byref to a function won't cause a problem. Since it is byref, you don't have to close it in the function being called, just in the calling procedure.

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