Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. what is "By Ref" and "ByVal"?

what is "By Ref" and "ByVal"?

Scheduled Pinned Locked Moved Visual Basic
question
6 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yonemay
    wrote on last edited by
    #1

    pls tell me

    V P R D 4 Replies Last reply
    0
    • Y yonemay

      pls tell me

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      i want you to Say with me next time i will google before i post in a Forum here is what you are looking for in Google. http://www.google.co.za/search?hl=en&q=byref+and+byvalue&meta=[^] it will help

      Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

      1 Reply Last reply
      0
      • Y yonemay

        pls tell me

        P Offline
        P Offline
        pmarfleet
        wrote on last edited by
        #3

        This question (and your other one) suggest that you haven't learnt the basics of the language yet. You shouldn't really ask questions like this in the forum. This information is freely available in the documentation[^]. I suggest you read it and learn the language fundamentals before posting again.

        Paul Marfleet

        1 Reply Last reply
        0
        • Y yonemay

          pls tell me

          R Offline
          R Offline
          rohitsrivastava
          wrote on last edited by
          #4

          the actual value is stored in variable in by val and in byval reference is stored in the variable and actual data is stored in the heap

          D 1 Reply Last reply
          0
          • R rohitsrivastava

            the actual value is stored in variable in by val and in byval reference is stored in the variable and actual data is stored in the heap

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Actually, you're answer is very wrong. You might want to Google it yourself too.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            1 Reply Last reply
            0
            • Y yonemay

              pls tell me

              D Offline
              D Offline
              dBrong
              wrote on last edited by
              #6

              Every variable or literal is stored somewhere in memory. When you 'pass a variable by reference' the address of the actual variable is passed to the subroutine/function. You are working with the actual data value. Passing by reference is good for large data structures, and objects. Changing the values of 'by ref' parameters is sometimes called a 'side effect'. Normally one does not do this. When you 'pass by value' the runtime makes a copy of the variable. The subroutine receives the copy. Whatever changes the subroutine makes to the variable - will not affect the calling program, since the 'by value' copy will be discarded, when the subroutine returns. There is no way you can have the 'side effect'.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups