How to pass arguments in VB.NET part-2

In this article we discus how you pass the arguments like pass integer to a function in VB.NET.
  • 1744

As you see the call ByVal type reference in my previous article now in this article we talk about the secound type of reference type its call ByRef means call by reference in this the reference of argument itself is send to the function.

EXAMPLE CODE

   Module Module1
        Sub value(ByRef A As Integer)
            A = 100
            Console.WriteLine("Value of A in sub: " & A)
        End Sub

        Sub
Main()
            Dim int As Integer = 50
            Console.WriteLine("value before function call: " & int)
            value(int)
            Console.WriteLine("value after exit function : " & int)
            Console.ReadLine()
        End Sub
    End
Module

OUTPUT
14.gif

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.