[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-11
4
Medium Priority
?
197 Views
Last Modified: 2013-11-26
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?
0
Comment
Question by:nosurf2day
  • 3
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 22938161
ByVal and ByRef: Passing Arguments in Visual Basic
http://visualbasic.about.com/od/learnvbnet/a/byvalbyref.htm

0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22938162
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)
a=50
b=60
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.
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 22938164
0
 

Author Closing Comment

by:nosurf2day
ID: 31515674
Once again, you rock!  Thanks for all the help, I have 30 min before I take my exam and I am feeling much better.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question