Library tutorials & articles

Passing Variables By Value or Reference

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.

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Passing Variables By Value or Reference.

  2. 28 Oct 2001 at 22:58

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

  3. 20 Nov 2001 at 22:30
    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
  4. 05 Feb 2003 at 19:33

    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.

Leave a comment

Sign in or Join us (it's free).

Mike J

Related discussion

Related podcasts

  • Visual Studio Talk Show (en français): Christian Beauclair

    Published 1 year ago, running time 0h51m

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss... de, il, christian, vb6

Want to stay in touch with what's going on? Follow us on twitter or Facebook!