Chapter 8. Arrays


Now go, write it before them in a table, and note it in a book.

Isaiah 30:8

With sobs and tears he sorted out Those of the largest size...

Lewis Carroll

Attempt the end, and never stand to doubt;

Nothing's so hard, but search will find it out.

Robert Herrick

Begin at the beginning, ... and go on till you come to the end: then stop.

Lewis Carroll

To go beyond is as wrong as to fall short

Confucius

Objectives

In this chapter you will learn:

  • To use the array data structure; arrays are objects.

  • How arrays are used to store, sort and search lists and tables of values.

  • To declare, initialize and refer to individual elements of arrays.

  • To pass arrays to methods using ByVal and ByRef.

  • To declare and manipulate multidimensional arrays, especially rectangular arrays and jagged arrays.

  • To create variable-length parameter lists.

  • To use the For Each...Next statement to iterate through the elements of arrays without using a loop counter.

Outline

8.1 Introduction

8.2 Arrays

8.3 Declaring and Allocating Arrays

8.4 Examples Using Arrays

8.4.1 Allocating an Array

8.4.2 Initializing the Values in an Array

8.4.3 Summing the Elements of an Array

8.4.4 Using Arrays to Analyze Survey Results

8.4.5 Using Bar Charts to Display Array Data Graphically

8.4.6 Using the Elements of an Array as Counters

8.5 Case Study: Card Shuffling and Dealing Simulation

8.6 Passing an Array to a Method

8.7 For Each...Next Repetition Statement

8.8 GradeBook Case Study: Using an Array to Store Grades

8.9 Rectangular Arrays

8.10 GradeBook Case Study: Using a Rectangular Array

8.11 Variable-Length Parameter Lists

8.12 Jagged Arrays

8.13 Changing the Size of an Array at Execution Time: Using the ReDim Statement

8.14 Passing Arrays: ByVal vs. ByRef

8.15 (Optional) Software Engineering Case Study:Collaboration Among Objects in the ATM System

8.16 Wrap-Up



Visual BasicR 2005 for Programmers. DeitelR Developer Series
Visual Basic 2005 for Programmers (2nd Edition)
ISBN: 013225140X
EAN: 2147483647
Year: 2004
Pages: 435

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net