Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 39,583 times

Contents

Related Categories

Passing Variables By Value or Reference - Introduction

mrjdesign

Introduction

I will here attempt to elaborate on the values of calling functions and other statements with variables defined By Value or By Reference. As a beginner one may find oneself rather confused by the different options and what impact they really have on the application you are currently engineering. In my personal experience, being referred to in many cases as a "speed freak, better off in another language than VB", I look to the issues of speed in execution.

We all know how tedious many tasks may seem when it comes to VB and the lack of really fast code to perform the simplest of efforts. Much more so when you call recursive loops or several If or For loops.

One step you may take is to choose a proper way of defining the reference point and fastest way for your program to use the values of your constants and variables. This is done by A) selecting the proper Variable Type and B) by defining the variable ByVal or ByRef, when calling following statements.

The ByVal and ByRef Keywords are used in relation to the following statements.

Call, Declare, Function, Property Get, Property Let, Property Set, Sub

In this tutorial/article I will only briefly describe the intricate details of these two keywords, in reference to the Function statement. The same applies to the others as well but for simplicity I will only use the most common here.


©2001 - All Rights Reserved - MRJ Design
The source code samples and information pertained within this document are considered copyrighted material and may not be re-distributed by electronic or other media in any form or fashion whatsoever, withou

Comments

  • Thanks :)

    Posted by mrjdesign on 05 Feb 2003

    It was fun to write it too... I still havn't gotten the hang on all ins and outs yet but I'm learning as I help others.

  • not that much

    Posted by http://vbxzone.tripo on 20 Nov 2001

    it was not a bad article. However it was kind of too abstract, and no code examples or anything. just pure bs on byref and byval

  • Informative

    Posted by outvit on 28 Oct 2001

    This was a very informative article. It was a pleasure to read.