Module Module2 Sub Main() Dim result As Integer Dim x, y As Integer Console.WriteLine("ByRef") Console.Write("Enter Original value1:") x = CInt(Console.ReadLine) Console.Write("Enter Original value2:") y = CInt(Console.ReadLine) Console.WriteLine() result = sum2values(x, y) 'calling the function with 2 parameters Console.WriteLine("Result=" & result) Console.WriteLine() Console.WriteLine("Now Values of x=" & x & " and y=" & y) Console.WriteLine() Console.WriteLine("x and y are changed") Console.ReadLine() End Sub 'defining a function with 2 parameters Function sum2values(ByRef x, ByRef y) 'modifying values of x and y Console.Write("Enter New value1:") x = CInt(Console.ReadLine) Console.Write("Enter New value2:") y = CInt(Console.ReadLine) sum2values = x + y End Function End Module
Visual Basic dot net VB.net programming microsoft .net framework object oriented language network enabled technology visual basic 2005 IDE integrated development environment console application microsoft cre common runtime environment
ByRef Calling
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment