Exam coming up, I have questions I need help answering.

I have an upcoming exam and I don't have access to my professor and I have questions that the book is not clarifying for me.  The book that the class is using is Murach's Visual Basic 2008.

iI will list the questions will by numbers.  I understand that there are alot of questions here but I really need a good grade on this exam and these are the areas that I am still unsure of.  Some of the questions, I have tried to answer and I posted a comment in (), it my guess is correct could you annotate so.  If not could you help me get on base.

I am taking the exam tomorrow at 11.  I have been buried in this book for a couple of days now and I need help.  I am using this site as a last resort.  I figured individuals on here are much more proficient than myself so I mine as well ask the experts.  

I want to thank anyone in advance that is willing to answer any of these questions for me.  God Bless and Happy Veterans Day.  I myself am an "Iraq Veteran" in 2003.3. When and how to pass arguments by reference and by value?
       - The book says this.  I dont understand what it is saying at all:

Arguments are passed by value.  Because of that, the procedure can change the value of the parameter without affecting the value of he variable in the calling procedure.

In some cases, though, you will want to be able to change the value of the variable in the calling procedure from the called procedure.  To do that, you can pass the argument by reference.
When you call the procedure, a reference to that variable is passed to the procedure.  As a result, if that called procedure changes the value of the parameter, it also changes the value of the variable in the calling procure.  

If you pas a reference type by reference, you still cant change its value (the reference), but you can change the values of members of the object it refers to.  In contras if you pass a reference type by value, you can change both its value and the values of its members.

Can you explain this in laymen terms?
Who is Participating?
DhaestConnect With a Mentor Commented:
ByVal and ByRef: Passing Arguments in Visual Basic

Byval is a way of passing parameters in by Value. This means that if you have 2 variables, a and b, and you pass them into a function with a=1 and b=2:

private sub function1(byval a as integer, byval b as integer)
end sub

Once you get out of this function, a will still be = 1, and b will still be = 2. If you were to use ByRef instead of byval... once you get out of the function a would b = 50 and b would be = 60.

Hope this helps.

By the way, passing parameters by reference is much more costly and time consuming than passing them by value.
nosurf2dayAuthor Commented:
Once again, you rock!  Thanks for all the help, I have 30 min before I take my exam and I am feeling much better.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.