Results 1 to 4 of 4

Thread: ByVal and ByRef

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Location
    y
    Posts
    141

    Unhappy

    Hi My Friends

    I have a big big Problem .

    In ASP page i have ..CreatObject(Dllname )..

    In VB I have function
    private Function ppSet(InputMap As Map, OutputMap As Map) As Boolean

    When i try that its fail i got TYPE MISMATCH

    But if i change it to rivate Function ppSet(ByValInputMap As Map,ByVal OutputMap As Map) As Boolean ...its work ...

    Why whaen i use ByRef its fail and when im use ByVal its work..
    What the difference ? (In Object)

    Thnsk
    Efrat

  2. #2
    Hyperactive Member vbuser1976's Avatar
    Join Date
    Sep 2000
    Location
    Yonkers, NY
    Posts
    404

    Cool Okay...

    When you pass an argument byRef or by reference, you are passing a pointer to the location in which the variable is stored, which means that if the value changes within the procedure, the change also affects the value outside the procedure.

    When you pass an argument byVal or by value, you are passing a copy of the value itself, which means that if the value changes within the procedure, the change does not affect the original value.

    Now, in response to your question, since the arguments that you are passing are objects not values, when you pass byRef, it is only passing a pointer to the object, not the object itself or a copy of the object. That is why you are getting the type mismatch when you use byRef instead of ByVal.

    I hope this helps you. Good luck!
    -vbuser1976
    VB6 Enterprise SP6
    SQL 7.0 SP2
    VBScript, HTML, Javascript, C++, a little UNIX

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Location
    y
    Posts
    141

    Thanks

    Thanks for your help

    Efrat

    efr@rocketmail.com

  4. #4
    Hyperactive Member vbuser1976's Avatar
    Join Date
    Sep 2000
    Location
    Yonkers, NY
    Posts
    404

    Cool Hi!

    Your welcome and Good Luck!
    -vbuser1976
    VB6 Enterprise SP6
    SQL 7.0 SP2
    VBScript, HTML, Javascript, C++, a little UNIX

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