Lesson 1.3 – Using Arrays

You need to be logged in to view this content. Please login or become a member.

<<  Prev   |   Index   |   Next  >>


Arrays are a convenient way to store multiple values in a single variable, making your job as a programmer much easier.


An alternative to arrays that is particularly useful when working with objects is the Collection. Items can be added or removed to collections very easily without any need to re-size the collection. Click here for an example.

Lesson Files

Lesson 1.3 code


Lesson 1.3 homework solution


  1. ChbutaI

    What’s the fastest way to populate multidimensional arrays? For example, instead of typing out the address of each array element and then equating it to a value: intArray(2,1) = 5 ….. Is there some way to put in all element values at once like this: intArray = [(5,8),(5,1)] ?

    • Good question. Unfortunately, I don’t know of a faster way. You might find some better help at vbforums.com. You might possibly be able to reduce the amount of typing involved by using the Split() function, however.

      • jwiltshi

        Just in case anyone sees this and is wondering the same thing. A way to populate arrays using a for loop:
        ( straight from the VB built in help)

        Sub FillArray()
        Dim curExpense(364) As Currency
        Dim intI As Integer
        For intI = 0 to 364
        curExpense(intI) = 20
        End Sub

Questions and Comments

You must be logged in to post a comment.