O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.6. Passing an Array to a Method

To pass an array argument to a method, specify the name of the array without using parentheses. For example, if array hourlyTemperatures has been declared as

					Dim hourlyTemperatures As Integer() = New Integer(24) {}

the method call

DayData(hourlyTemperatures)

passes array hourlyTemperatures to method DayData.

Every array object “knows” its own upper bound (i.e., the value returned by the method GetUpperBound), so when you pass an array object to a method, you do not need to pass the upper bound of the array as a separate argument.

For a method to receive an array through a method call, the method’s parameter list must specify that an array will be received. For example, the method header for DayData might ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required