O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

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

Initializing Arrays

Arrays are static in memory: once created, they can no longer be changed. But an object variable that points to a particular array type can be pointed to a different array of the same type, even one with a different number of elements. You can do this in one of several ways. The instant you define an array and specify the number of elements it will contain, the .NET Framework reserves the memory space for those elements, as shown in the following:

'Byte array with 11 elements (0-10)
Dim myByteArray(10) As Byte

This statement establishes an array of the type Byte, and at the same time it reserves the memory space for 11 Byte elements.

Changing Array Dimensions at Runtime

In some cases, it might make sense to initially define an ...

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