Explore BrainMass
Share

Visual Basics 2010 Beginner

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Please help design a program that demonstrate passing arguments ByVal and then ByRef. Help is needed with the coding.

It is suggested that I create a square function procedure and get an integer from the user then send it ByVal one time and get the result from the procedure and have the main program display the result. Then you can send it ByRef and have the procedure modify the original variable with the result which can be displayed.

© BrainMass Inc. brainmass.com March 22, 2019, 1:17 am ad1c9bdddf
https://brainmass.com/computer-science/graphics/visual-basics-beginner-531681

Solution Preview

See attachments.

Module Module1

'function which calculate squre of a number passed as value
Private Function SquareByVal(ByVal num As Integer) As Integer
num = num * num
Return num
End Function

'function which calculate squre of a number passed as reference
Private Function SquareByRef(ByRef num As Integer) As Integer
num = num * num
Return num

End Function

Sub Main()

Dim displayResultByVal As Integer
Dim displayResultByRef As Integer

'ask user to enter ...

Solution Summary

The solution discusses the visual basics 2010 beginner.

$2.19